sql query in onchange script

Hello,

I have a custom entity and want to get a value (price) from a custom sql-table based on the chosen value of three fields (product, channel, place)

Every time one of the three fields were updated in the screen I need to update the price.

In the onchange scripts of these three fields I can not use server-side commands like "CRM.CreateQueryObj".

How can I solve my problem?

Thank you in advance!

Parents Reply
  • 0 in reply to Sage CRM

    That seems to work with standard entities for me now like this:

    var CrmExample = CrmExample || {};
    
    CrmExample.doit = function () {
    var compField = crm.fields("vpos_text1");
    var companyID = 10141;
    var successCompany = function(crmRecord)
    {
    //crm.infoMessage(crmRecord.comp_name);
    compField.title("Status: "+crmRecord.comp_status +"\n Type: "+crmRecord.comp_type);
    document.EntryForm["vpos_text1"].value = crmRecord.comp_status;
    }
    crm.sdata({
    entity: "company",
    id: companyID,
    success: successCompany
    });}

    Now I create a linked table to another database with allowed reading option by sdata.

    When I try to get data from sdata like this 

    http://xxcbx05/sdata/CRMj/sagecrm2/-/KagCRMPreise

    I could not download the data.

    With the SQL Server Profiler I can see that the SQL-Server gets the demand with:

    exec sp_prepexec @p1 output,NULL,N'SELECT COUNT(*) FROM KagCRMPreise WITH (NOLOCK) WHERE null_Deleted IS NULL'

    How can I get data from that linked table in my code?

Children