How to get application Id in server side?

Posted by Wave Kasipat on 15-Jun-2016 03:47

How to get application Id in server side?

(e.g. in trigger or formula field)

 

Thanks,

Kasipat

Posted by Shiva Duriseati on 15-Jun-2016 04:19

Hi Kasipat,

There is no direct API which list application id from server side. But still you can make REST calls in the trigger.

The following code uses two rest calls, first one will get sessionId and second will be passed to another rest call.

var url = "localhost:8080/.../login";
var params = {"loginName":"shiva.durshetti@gmail.com","password":"iworkinprogress"};
var resp = rbv_api.sendHttpPost(url, null,params, null);
var sessionId=String(resp.match(/<sessionId>(.*)<\/sessionId>/g)).replace(/<\/?[^>]+(>|$)/g, "");//This will retrieve the session id from the response
var appId="localhost:8080/.../getApplicationIds
var appParams={"sessionId":sessionId};
var appIds = rbv_api.sendHttpGet(appId);
rbv_api.print(appIds);

Regards,

Shiva

All Replies

Posted by Shiva Duriseati on 15-Jun-2016 04:19

Hi Kasipat,

There is no direct API which list application id from server side. But still you can make REST calls in the trigger.

The following code uses two rest calls, first one will get sessionId and second will be passed to another rest call.

var url = "localhost:8080/.../login";
var params = {"loginName":"shiva.durshetti@gmail.com","password":"iworkinprogress"};
var resp = rbv_api.sendHttpPost(url, null,params, null);
var sessionId=String(resp.match(/<sessionId>(.*)<\/sessionId>/g)).replace(/<\/?[^>]+(>|$)/g, "");//This will retrieve the session id from the response
var appId="localhost:8080/.../getApplicationIds
var appParams={"sessionId":sessionId};
var appIds = rbv_api.sendHttpGet(appId);
rbv_api.print(appIds);

Regards,

Shiva

This thread is closed