function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ChrisparxChrisparx 

Trigger with web service with Session Id, Server URL ...help !

Hello,

 

I'm looking to call an external URL from a trigger in order to send some informations based on the trigger itself...

 

I know I have to append the annotation @future, it's not the problem. If I call this URL from a button, it's completely working, but from a trigger, I have to convert my actual API.Session_ID and API.Partner_Server_URL_XXX to something else... and I don't find how I could do that. I just found that for the session_ID, I could use the UserInfo.getSessionId() ... but what about the Server URL ?? Could you provide some assistance ??

 

Thank you !!

sforce2009sforce2009

serverURL is not provided in userInfo. You need to store it at user level on in some object, using a formula field

ChrisparxChrisparx

Thank you it's now working ... another question.

 

I'm triing to adapt the URL of an App (usually called trough a button in a browser) to my trigger. The URL built is completely right but when my trigger is executed, it does nothing (I don't get an error in my debug log, just a read timeout). I'm calling this URL with a GET Method (not sure if it's the right one) with a long keep alive (well enough long) and the App should makes some operations on my main object. But when I call this URL through my trigger, it goes to a time out and does nothing (the same URL is working in a browser and the operation is done within 5 seconds). Any thoughts ?

 

 

sforce2009sforce2009

I am not sure, if I understand you. Are you trying to call some URL in a trigger? If this is the case, you can not do that, because Triggers won't involve any UI. They will run in the backend.

Please clarify, so that I can sugest some alternative.

ChrisparxChrisparx

well I have a trigger where I generate my SessionId (UserInfo.getSessionID()) , I call a class (with a callout), send my session Id to my @future class and from this class, I would like to call an URL which is usually called by clicking on a salesforce URL button.

 

And my URL is correct because if I copy paste the URL from my debug log to any browser, the call is in the browser successfull (the work has been done in my salesforce org).