Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7248503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:08:49+00:00 2026-05-28T22:08:49+00:00

i,m trying to write a trigger in SalesForce Opportunity which have to send the

  • 0

i,m trying to write a trigger in SalesForce Opportunity which have to send the updated StageName to external webservice using predefined username and password.

here is sample code:

trigger isStageChanged on Opportunity (after update) {
    for (Opportunity o : Trigger.new) {
        Opportunity beforeUpdate = System.Trigger.oldMap.get(o.Id); 

        if(beforeUpdate.StageName != o.StageName) {
            // Call WS
        }
    }

}

“Call ws” means to use link like:
http://mydomain.com/webservice/index.php?username=MY_USERNAME&password=MY_PASS&stage=opportunityNewStage

The question is: Where can i store MY_USERNAME and MY_PASS in case i want to use this trigger on different SalesForce customers and to let them configure them after install?
When i red the APEX Code Developers Guide i red that i can use a Web Services API to deploy my trigger and that way i can store user and pass on my server. Is it possible?
On my server i’m using php.

I hope i am clear in my question.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T22:08:49+00:00Added an answer on May 28, 2026 at 10:08 pm

    You should probably store the username and password using custom settings. This will allow their administrator to easily configure the username and password with values they provide.

    Note that you can’t make a callout from inside a trigger as it holds up database operations, instead you need to put your callout in a public/global method of another class, using the @future annotation:

    @future public void DoMyCallout(list<id> liOpportunities)
    {
        // load your oppties if need be, then do the callout
    }
    

    @future indicates that this method will run asynchronously, so you can call it from the trigger but it will run in another thread and so not hold up the database operation in progress.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying write a query to find records which don't have a matching record
I am using SSMS 2008 and am trying to write a trigger now to
I'm trying to write a table trigger which queries another table that is outside
I'm trying to write an after update trigger that does a batch update on
Im trying to write something to get my images to show correctly. I have
I'm trying to write a blog post which includes a code segment inside a
Has anyone noticed this behavior? I'm trying to write a script that will trigger
I have many TextBox controls and I'm trying to write a style that clears
I'm trying to write a trigger in MySQL and I need to set the
I am trying to write a stored procedure in MySQL which will perform a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.