Service

Get Involved. Join the Conversation.

Topic

    Shaheela D
    How to make primary contact as default of the account while...Answered
    Topic posted June 24, 2019 by Shaheela DBronze Medal: 1,250+ Points, tagged Service Request Management 
    53 Views, 1 Comment
    Title:
    How to make primary contact as default of the account while creating SR
    Summary:
    Map the account and primary contact in service request object
    Content:

    Hi Team,

    While creating service request from SR UI, based on the account the primary contact should be populated. As of now the standard functionality is based on the primary contact, the account was mapped automatically. But as per our requirement it should be from Account to Primary contact.

    I have tried below script to achieve. But that is not working for me. 

    def accountid = AccountPartyId
    def ContactName
    if(AccountPartyId != null)
    {
    def voBP = newView('SalesAccountVO');
    def vcBP = voBP.createViewCriteria();
    def vcrBP = vcBP.createRow();
    def vciBP = vcrBP.ensureCriteriaItem('PartyId');
    vciBP.setOperator('=');
    vciBP.setValue(accountid);
    vcBP.insertRow(vcrBP);
    voBP.appendViewCriteria(vcBP);
    voBP.executeQuery();
    while (voBP.hasNext())
    {
    def rowAccount = voBP.next();
    ContactName = rowAccount.PreferredContactName;
     // println("ContactName:"+ContactName)
    }
      setAttribute('PrimaryContactPartyName',ContactName)
    }

     

    In which I have used the SalesAccount object  since there is no relationship between service request and account object.

    Can anyone aware of this please guide me to proceed further.

    Note:

    Both account and primary contact gets populated when the SR created from web portal (DCS)

    Thanks,

    Shaheela

     

    Version:
    19B
    Image:

    Best Comment

    Shaheela D

    Hi All,

    I have changed the salesAccountVO as Organization profile and get the primarycontactID from that and mapped into Contact field now which is working.

    Thanks,

    Shaheela

    Comment

     

    • Shaheela D

      Hi All,

      I have changed the salesAccountVO as Organization profile and get the primarycontactID from that and mapped into Contact field now which is working.

      Thanks,

      Shaheela