Issues with a!PickerFieldUsers() function

Certified Associate Developer

Hello,

I have a requirement to build up a dynamic form based on the CDT we receive from API call. On the basis of keyAttribute value we are displaying the various controls. Now what i'm doing is I'm displaying the controls and their default values from the CDT received and saving the values to another CDT. Every other controls are working fine but with a!pickerFieldUser() funciton i'm getting errors. Below is the code I'm using

 

load(
local!tempUservalue:if(or(isnull(ri!defDataContentMetrics_cdt[ri!index].FormAttributeValue),
len(ri!defDataContentMetrics_cdt[ri!index].FormAttributeValue)=0),
null,
ri!defDataContentMetrics_cdt[ri!index].FormAttributeValue
),

with(
a!pickerFieldUsers(
label:ri!defDataContentMetrics_cdt[ri!index].ContentMetric,
lablePosition: "ABOVE",
maxSelections: 1,
value: local!tempUserValue,
saveInto: {
local!tempUserValue,
a!save(
ri!defDataContentMetrics_cdt[ri!index].FormAttributeValue,
if(
or(
isnull(save!value),
len(save!value) = 0
),
null,
save!value
)
),

 

a!save(
ri!ContentMetricsUpdatedValue_cdt[ri!index].FormAttributeValue,
if(
or(
isnull(save!value),
len(save!value) = 0
),
null,
save!value 
)
)
},
required: if(ri!defDataContentMetrics_cdt[ri!index].Required=1,true,false)
)

)
),

 

Where defDataContentMetrics_cdt is fetching values from API Call and ContentMetricsUpdatedValue_cdt is used to store the values. Can somebody tell me what is wrong inside the code?

  Discussion posts and replies are publicly visible

Parents Reply
  • The username you are cancelling out is attempting to save into index position 10 of ri!ContentMetricsUpdatedValue_cdt. I am assuming you are generating this rule for each item in ri!defDataContentMetrics_cdt, but the CDT you are saving to does not have the same length, so your ri!index of 10 is not present for ri!ContentMetricsUpdatedValue_cdt.

    If you believe ri!ContentMetricsUpdatedValue_cdt does have the correct length, you should also check that ri!ContentMetricsUpdatedValue_cdt is marked as an array on your inputs.
Children