-4

i need trigger a value before saving the record into database( i have a custom field product name in opportunity when ever i enter product name it should call callouts(oracle ebs-cloud) for number of quantity available for that product it should be place into quantity field (opportunity) before saving record this my requirement....

we can use trigger before saving record

  • what's your question? where exactly you are facing issues? – Santanu Boral Jun 27 '17 at 04:57
  • Tharun, the only issue I see as of now could be comparing the product name with 'null' string, whereas it should be opp.Product_name__c != null, null without quotes. – Nitish Singhal Jun 27 '17 at 05:13
  • i need trigger a value before saving the record into database( i have a custom field product name in opportunity when ever i enter product name it should call callouts(oracle ebs-cloud) for number of quantity available for that product it should be place into quantity field (opportunity) before saving record this my requirement--Santanu Boral – tharun yadav Jun 27 '17 at 05:24

1 Answers1

0

Based on the clarification in comments:

It can not be done in realtime as you are expecting, because you will be making a callout and callout will be done from a helper class's @future method, and future methods are asynchronous. Their results are not sure to be in real time.

So, what you can do, you can call a @future method, and pass the Opportunity Id. Once the response comes back, Opportunity will be updated in future method then.

You can also refer the below link for more details.

Click here for more information

Nitish Singhal
  • 753
  • 6
  • 14