IT Process Automation

 View Only
  • 1.  Issue with Special Character '@' in ValueMap Dataset Variable name

    Posted Oct 10, 2018 03:36 PM

    Objective : HTTP GET  SDM API operation to find the contact_uuid of the users.

    Operation successfully returns the contact information, however facing challenge in assigning the id value to process variable.

     

    Process.getPamUserResponse = convertJson(Process[OpName].HTTPResponseContent);
    Process.PAMUserUUID = Process.getPamUserResponse.collection_cnt.cnt.@id;

     

    Error message

    Error in post-execution code. Failed to execute code:
    Process.getPamUserResponse = convertJson(Process[OpName].HTTPResponseContent);
    Process.PAMUser = Process.getPamUserResponse.collection_cnt.cnt.@id;

     

    -- TypeError: Cannot find default value for object. (#3)

     

     

    please suggest me how to fix the error.



  • 2.  Re: How to parse JSON response to Process variable
    Best Answer

    Broadcom Employee
    Posted Oct 10, 2018 04:00 PM

    Perhaps this will help:

     

    convertJson Function - CA Process Automation - 04.3.03 - CA Technologies Documentation 

     

    The convertJson function should return a valuemap.  So to reference a value in that valuemap you need to specify the index number in brackets somewhere.  I can't quite tell from your screenshot but my guess is that the value map is at the getPAMUserResponse level?  

     

    If that doesn't help, perhaps showing the full value of Process.getPamUserReponse would help to troubleshoot further.



  • 3.  Re: How to parse JSON response to Process variable

    Posted Oct 11, 2018 02:18 AM

    below is the HTTP JSON Response to GET operation.

    Process.HTTP_Get_1.HTTPResponseContent  ={"collection_cnt":{"@COUNT":"1","@START":"1","@TOTAL_COUNT":"1","cnt":{"@id":"U'756CBC020CE43147BFAD8232DFB3AEAA'","@REL_ATTR":"U'756CBC020CE43147BFAD8232DFB3AEAA'","@COMMON_NAME":"PAM, Integration ","link":{"@href":"http:\/\/mysdmserver:8050\/caisd-rest\/cnt\/U'756CBC020CE43147BFAD8232DFB3AEAA'","@rel":"self"}}}}

     

    Converting JSON String to ValueMap

     

    Process.getPamUserResponse = convertJson(Process[OpName].HTTPResponseContent);

     

    ValueMap Structure 

     

     

    Now I want to capture the UUID Of contact by 

     

    Process.PAMUserUUID = Process.getPamUserResponse.collection_cnt.cnt.@id;

     

    but system is throwing an error 

     

    Line 2: Process.PAMUserUUID = Process.getPamUserResponse.collection_cnt.cnt.@id;

    Expected an identifier and instead saw '@'.

     

     

     

     

    Error in post-execution code. Failed to execute code:
    Process.getPamUserResponse = convertJson(Process[OpName].HTTPResponseContent);
    Process.PAMUser = Process.getPamUserResponse.collection_cnt.cnt.@id;

     

    -- TypeError: Cannot find default value for object. (#3)

     

    how to get the @id value successfully from the ValueMap.

     

    Thanks



  • 4.  Re: Issue with Special Character '@' in ValueMap Dataset Variable name

    Posted Oct 11, 2018 05:56 AM

    used the Javascript replace method on Raw Json string to replace @REL_ATTR to REL_ATTR.

    So the special character @ is replaced. 

     

    suggest me for any better approach.

     

    var jsonString = Process[OpName].HTTPResponseContent.replace("@REL_ATTR","REL_ATTR");
    Process.getPamUserResponse = convertJson(jsonString);
    Process.PAMIntegration = Process.getPamUserResponse.collection_cnt.cnt.REL_ATTR;
    logEvent(1, "Info", "This is a test for logEvent


  • 5.  Re: Issue with Special Character '@' in ValueMap Dataset Variable name

    Broadcom Employee
    Posted Oct 19, 2018 09:12 AM

    We are not process design experts in support so this solution is the best we know of.  If you are experiencing a problem with this solution, let us know and we can try to review further.  Otherwise perhaps someone else on the communities would know of a better way.  But hopefully this solution is working for you.