How can I get information associated to a random Company from Opportunity screen

I am trying to retrieve information associated to a random company to display in Opportunity screen.

The workflow is as follows
=========================

1) When trying to create new opportunity

2) In the Opportunity Detail section of the screen, I have a field called "Site" which is a Search Select Advanced field and "Site Id" which is a text field. (NOTE: "Site" represents a company.)

3) When I select a company using "SIte" field, A "Site Id" associated to that particular company should be displayed in the "Site Id" text field.

How can I do this?

I have attached a screenshot to illustrate how it is seen on the opportunity screen.

Thanks

Satheejan

  • 0

    I tried to do this using CRM.FindRecord, but it didn't work as it is server side, so I spoke to Andy Hall, who put me straight and told me to use sdata. He also started to tell me about a time he saw Richard Branson in a hot air baloon, but I stopped listening so I didn't get all the details of that.

    In this example, the company SSA field is named oppo_tp_companyId, and the 'Site Id' field is namd oppo_tp_site...

    So, if you are using v7.2 or above, you can put:

    function AddSite()
    {
    var companyID = crm.fields("oppo_tp_companyid").value();
    var Site = function (crmRecord) {
    crm.fields("oppo_tp_site").val(crmRecord.comp_tp_site);
    }
    crm.sdata({
    entity: "company",
    id: companyID,
    success: Site
    });
    }


    On the custom content of the screen, then:

    AddSite();


    On the on change for the oppo_tp_companyid

    The reference for this is on the client side API help:

    http://help.sagecrm.com/js-api/classes/sdata.html

    Hope that helps.