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
bhagya manshanibhagya manshani 

Future Method With Return Value from Web service..... Please Help Thanks In advance

I am calling web service( Generated from WSDL) from trigger . 

// Here is my trigger

trigger reminder on Lead (after insert) {
  
  ///Lead[]lead = Trigger.new; 
  //reminderTask.setRemainder(lead);
  //reminderTask.SetConverted_LeadFalse();
  //myclass.test();
  //testforweb ob=new testforweb();
  //String token= ob.testweb();
    call_webtest.myMethod(); 

 

 

 

 

trigger reminder on Lead (after insert) {  

    String token = call_webtest.myMethod(); 

}

// Here is my class

   global class call_webtest {


   public global static String token;

     

    @future(callout=true) public static void myMethod()

    {

           wwwWso2OrgPhp.QMetryWSSOAPPort_Http obj = new wwwWso2OrgPhp.QMetryWSSOAPPort_Http();

            token = obj.login('amardeep','amardeep1@#4');   // get the token from web service( No Problem In That)

         Question:  I want to return that Token in my Trigger But Future method must be void and no Return Statement

     }

    

}

 

How Can I resolve that Problem Please Help .  I need that Token In My trigger

NaishadhNaishadh

you cannot pass value from future method to trigger. What exactly you want to achieve. If your trigger code just store that token value into database you can put that code into your future method.

marioluisscmarioluissc

With the Java Language, its this work. But, with the APex Language, it isn't work.

I already had problems with this. I just had one alternative: to salve the variable in the database in your method static.

After you can to get the value using the SOQL Statement, in your trigger.