Trying to get custom field options using data method

I am trying to get a nested (dependent) custom field option using the data method. I tried the same format as suggested in the documentation.

format: {{customfield}}_options

code:

client.data.get("cf_l1_options").then ( //working
    function(data) {
      console.log(data); 
    },
    function(error) {
     console.error(error);
    }
  );

client.data.get("cf_l2_options").then ( //throwing error
    function(data) { 
      console.log(data);
    },
    function(error) {
     console.error(error);
    }
  );


client.data.get("cf_l3_options").then (. //throwing error 
    function(data) {
      console.log(data);
    },
    function(error) {
     console.error(error);
    }
  );

In the above code, I am trying to get options for level1, level2 and level 3 fields. For level 1 fields it is not throwing any error, the options array is returned as expected. But for level2 and level3 fields I tried the same code using the appropriate field name it is throwing an error.

Error:  {message: 'Invalid attribute provided.'}

Field JSON:

I am not sure why it is not working for level 2 and level 3 fields. can someone please help me with this?

1 Like

Hi @Amaresh_S_M,

This syntax only works for the first-level field. It’s not possible to get the second and third level field values with the Data method. It’s currently in the design stage to allow getting those nested field values as well.

As a workaround, Get Ticket API can be used to get the current values of the nested fields values for the ticket.

We will announce to the community when it’ll be available. I will pass your feedback as well to the product team.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.