Solved

API: Selecting Single Select based on the Name

  • 8 August 2023
  • 1 reply
  • 111 views

Userlevel 1
Badge +4

Hello 

 

I am trying to make api call (JSON) through RESTAPI 

I have retrieved all the custom fields and values by using: 

assystREST/v2/events/5005159?fields=customFields,customFields.singleSelectValue,customFields.systemLookupValue,customFields.multiSelectValues.value

 

Now I have the shortcode and name of the selected field 
received from the above:

<customFields>

        <cacheable>true</cacheable>

        <dataLocale>default</dataLocale>

        <entityDefinitionType>1</entityDefinitionType>

        <id>221310</id>

        <objectAvailable>true</objectAvailable>

        <systemRecordFlag>false</systemRecordFlag>

        <version>3</version>

        <imageId>0</imageId>

        <richRemarks/>

        <customFieldShortCode>ENVIRONMENTS IMPACTED</customFieldShortCode>

        <customLookupValueShortCode>4-PRODUCTION</customLookupValueShortCode>

        <entityInstanceId>5005159</entityInstanceId>

        <customFieldId>32986</customFieldId>

        <customFieldType>6</customFieldType>

        <singleSelectValue>

            <entityDefinitionType>1</entityDefinitionType>

            <id>1</id>

            <objectAvailable>true</objectAvailable>

            

            <name>Production</name>

            <remarks></remarks>

            <shortCode>4-PRODUCTION</shortCode>

            <definitionStateGroupId>-1</definitionStateGroupId>

            <parentWebCustomLookupDefinitionId>1</parentWebCustomLookupDefinitionId>

        </singleSelectValue>

        <customLookupValueId>1</customLookupValueId>

    </customFields>

 

what I need to do I need to use the name rather than using the shortCode for “single select values” as the system I am integrating with is using the name only that shows for the users.

 

 

 

on my call to create the event

 

I have tried

“customLookupValuename”:”Production”

/

“customLookupValueName”:”Production”

but it didn’t work

 

I have also tried it this way but it didn’t work 

 

              {
        "customFieldShortCode": "ENVIRONMENTS IMPACTED",
        "customLookupValueId": { "resolvingParameters":
         [
            {
                
                "name": "Production" 
            }
            
        ]
      }
        
       
            }, 

and

              {
        "customFieldShortCode": "ENVIRONMENTS IMPACTED",
        "customLookupValueId": { "singleSelectValue":
         [
            {
                
                "name": "Production" 
            }
            
        ]
      }
        
       
            }, 

 

I have checked assystWiki documentation as well but I couldn’t resolve it need your expertise :

https://wiki.axiossystems.com/assyst11-5Wiki/index.php/Integrations:assystREST_More_Examples#Custom_Forms

https://wiki.axiossystems.com/assyst11-5Wiki/index.php/Integrations:assystREST_More_Examples#Custom_Fields

https://wiki.axiossystems.com/assyst11-5Wiki/index.php/Integrations:assystREST_More_Examples#Additional_Parameters

https://wiki.axiossystems.com/assyst11-5Wiki/index.php/Integrations:assystREST_More_Examples#Change_Example

icon

Best answer by ianm 9 August 2023, 18:04

View original

1 reply

Badge

Hi,

Unfortunately there is no way to pass the selected custom lookup name directly to assyst during the event creation - it needs to be the shortcode or id.

If you only have the name then before creating the event you will need to retrieve the form definition for the event you are creating. You will need code to parse the response and work out the available single select options.  This will allow you to obtain the shortcode (or id) by matching the available names against the name you have.  You can then pass the shortcode  (or id) when creating the event.

The REST call needed to get the form definition will depend on whether the event is a system or custom form, or a service offering.

More info can be found at the following links 

For system forms and service offerings:  https://wiki.axiossystems.com/assyst11-5Wiki/index.php/Integrations:assystREST_More_Examples#Custom_Fields

 

For custom forms: https://wiki.axiossystems.com/assyst11-5Wiki/index.php/Integrations:assystREST_More_Examples#Custom_Forms

 

Ian

Reply