Sage CRM 7.3 - dynamically set SSA field

Hello,

I'm trying to auto-set a SSA field on the client side, based on a value the user selects in another SSA field on the main entity.

Scenario: User goes to "New Case" screen. Enters in a serial # (custom entity). The serial # has the company_id value. I can successfully gather the company_id via javascript. What I need to do now is, after serial # selection, attempt to auto-populate the company SSA field in the "For" section of the New Case screen.

Is this possible? I'm sure it is somehow, because I have the company_id value, what I'm worried about is since I'm new to Sage CRM, I may be trying to make this too complicated via javascript, and there may be some existing native functionality to do this.

Thank you for any help.

Joe

  • 0

    Hi Joe,

    Assuming you already have script to extract company_id from your serial # field then this should be fairly easy to do.

    Using the CRM Client-side API the crux of the code you're after is:

    var company_id = your_code_here;

    crm.fields('case_primarycompanyid').val(company_id); // (change case_primarycompanyid if the field is called something else)

    I'm not sure how you have your Cases screen set up but you'd probably want this in either an OnChange Script or in the Custom Content of the screen.

  • 0

    Hello,

    Thanks for the response. I had tried something similar to that, but wasn't getting the functionality I was looking for. This morning I finally found what I needed. After I collect the company_id, I pass that value to an existing function called SetIDcase_primarycompanyid(). That then properly populates the Company SSA field in the "For" block, in the same fashion as if someone were to search for a company and click on the company to select it.

  • 0

    Glad you got it sorted! :)

  • 0 in reply to jd139562

    We are currently checking the capability of sData CRUD operation of Sage CRM.  We are currently checking it with POSTMAN with Sage CRM 2020R2 and Sage CRM 2022.  We are trying to create complete Company record in one single request which has its persons, addresses, phone and email records.  But it seems that, it is failing to create it’s record with proper type in all the link table. 

    Attached is the JSON which we tried sending through POSTMAN but it gives error as shown in below screenshot.  But if I remove Emaillink section from JSON, it works but it enters data into all the link table with type as NULL.

    So based on this I have below some questions.

    1. I can create a record for single entity. But what if I want to create a record in PARENT as well as it’s child entities in one single HTTP request ?   Like company record with all it’s persons, address, emails and Phone?
    2. Entry in EmailLink Table is going with Type as NULL. How I can specify a particular type like Business/Sales for link record?
    3. Entry in PhoneLink Table is going with Type as NULL. How I can specify a particular type like Business for link record?
    4. Entry in Address_Link  table is going with Type as NULL. How I can specify a particular type like Business for link record?
    5. Entry in Person_Link  table is going with Type as NULL. How I can specify a particular type like Business for link record?
    6. Not able to specify Primary Person of Company. How to specify it in same single request?
    7. Not able to specify Primary Address of Company. How to specify it in same single request ?
      {
          "comp_name": "Test Company-2221",
          "comp_companycode": "ABX",    
          "comp_type": "Customer",
          "comp_sector": "Agriculture",
          "comp_status": "Active",
          "comp_source": "Phone",
          "comp_secterr": -2147483640,
          "Person": {
              "pers_lastname": "Smith",
              "pers_firstname": "Dan",
              "Address": {
                  "Addr_Address1": "Add1-P",
                  "Addr_Address2": "Add2-P",
                  "Addr_City": "Chikago",
                  "Addr_State": "NY",
                  "Addr_Country": "US"
              },
              "Phone": {
                  "Phon_CountryCode": "12",
                  "Phon_AreaCode": "122",
                  "Phon_Number": "1222222"
              }
          },
          "Address": {
              "Addr_Address1": "Street1",
              "Addr_Address2": "Street2",
              "Addr_City": "New York",
              "Addr_State": "NY",
              "Addr_Country": "US"
          },
          "Phone": {
              "Phon_CountryCode": "10",
              "Phon_AreaCode": "123",
              "Phon_Number": "1234567"
          },
          "Email": {
              "Emai_EmailAddress": "[email protected]",
                  "EmailLink": {
              "Elink_type": "Business"
               
              }
               
          }
      }