Accessing field values from another entity via an advanced search select

Hi,

I've been tasked by my manager to see if it is possible to pull information from a quote into an opportunity.

At the moment within our test system, I managed to get an advanced search select to look at the quotes that were created from a opportunity, I've been trying for a while to pull certain values from the selected quote to populate opportunity fields, the reason behind this is to have our users have a quick "summary" of a quote that will most likely to convert into an order.

I'm familiar with accessing information across entities with CRM.GetContextInfo("entity","field name") but only when it's been a 1:many relationship for example, quotes getting information from the opportunity as in our CRM one opportunity can have many quotes but not the other way round.

We're hoping this can be done, I've tried different ways of approaching it but no luck,

Any help on this would be amazing,

Thanks in advance,

Lee

  • Hi everyone,

    Using the link from Jeff, I've tried writing up script and no luck, this is what I came up with

    crm.ready(function()

    {

    var quoteField = crm.fields("oppo_primequote");

    var quoteID = quoteField.value();

    var successQuote = function(crmRecord)

    {

    crm.fields("oppo_quotevalue").value = quoteField.quot_quotevalue;

    }

    crm.sdata

    ({

    entity: "Quotes",

    id: quoteID,

    success: successQuote

    });

    })

    Any help on getting this right would be amazing :)

    Thanks in advance

    Lee

  • Where have you put the script? In the custom content on onchange for the oppo_primequote field.

    The issue is 'probably' this line:

    crm.fields("oppo_quotevalue").value = quoteField.quot_quotevalue;

    which should be something like:

    crm.fields("oppo_quotevalue").value(crmRecord.quot_quotevalue);

    Just on that, its worth knowing that best practice is to use a prefix to the field to denote its custom, for example oppo_c_primequote. This means that if Sage ever added new functionality that used a new field call oppo_primequote it wouldn't break your existing code. It also helps to understand whats custom and what not in the future.

  • Hi Daniel,

    I'll try the change to see if that works, thank you on the advice with the field names, I'm currently testing this in our test crm so most of the fields are custom.

    I add my company initials and my name into the field name to know who created the field.

    Thanks once again Daniel

    Lee