+ Start a Discussion
finkyfinky 

Dynamically update fields?

My problem is this.  When in Opportunities, I use an S-Control to launch a custom object (Ticket) in edit mode.  The Ticket pre-populates with several fields from the master Opportunity filled in.  One of the fields is Selling Concession. 

My question is, is it possible to update the Selling Concession field on the Ticket if it has changed on the master Opportunity? 

I'm not really an Apex programmer yet, and I'm using Professional Edition (considering upgrading to EE), but would like to see how I can do this. 

If it is not possible to dynamically link the fields, is it possible to update the value when I take a certain action or run certain code?

Thanks in advance
RickyGRickyG
I believe it is never a good idea to replicate data in two places, for exactly this type of reason.  Why not have a relationship between the Ticket object and Opportunity?  That way you don't have to worry about synchronizing data, and you could create a custom mini-layout so that a user could see the Selling Concession when they let the mouse linger on the lookup.
 
You would not need to upgrade to UE to use Apex Code, either.
 
Hope this helps.
 
- Rick Greenwald
Developer Evangelist
finkyfinky
Rick, thank you for your thoughts.  You're dead on right about having the same data in two places. Ideally, I could simply use the "Sales Credit" field on the standard object Opportunity in a formula in my "Tickets" custom object (i.e. formula equlas a field on the standard object time a field on the custom object), but that is prohibited.

You suggest a relationship. I'm not sure how to do this. I don't want a lookup field because there's really no choice involved.  I simply want to use  the value of a  specific field in the Master object (i.e. Opportunity).  I can't use Master-Child relationship becasue I'm already using that to pull in another data field and SFDC only lets me use one Master-Child relationship per custom object

Is there another "relationship" I can use?

Thanks in advance

Dave
RickyGRickyG
Dave -

On further consideration -

How about a very simple s-control?  Not a lot of code to fetch the value from the Opportunity record, and then display it in a page.  If you want to give the user the opportunity to update the info, you could make the value act as a link to the Opportunity page. Plus, you will only need to go to EE to get it to work.

This, of course, assumes that you only want to update the value in the Opportunity record.  If you want to allow updates in both Opportunity and Tickets, you are just about to step off the 'synch problem' cliff - which is why I suggested not duplicating the data.

Hope this helps a bit more.

- Rick Greenwald
Developer Evangelist
finkyfinky
When you mention fetching the value from the Opportunity, do you mean via API?
RickyGRickyG
Yes, that is the way that s-controls can access data stored in salesforce.

- Rick Greenwald
Developer Evangelist