- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2023 04:51 AM
Morning!
I am looking for assistance in an issue around mapping NULL values.
I have a flow action that is parsing a payload, it looks at the pay load and extracts data. There is then a simple update in the flow that is updating fields on a record based on those extracted values (logged to flow variables). It is working as expected unless that value is NULL. So if the value is updated to nothing, then we want to to remove the value on its destination record.
How can this be accomplished in the logic?
Error in the flow when NULL value
Action parsing the payload "custom Jira Fields action"
Script step:
(function execute(inputs, outputs) {
var data=JSON.parse(inputs.payload);
gs.info(inputs.payload);
//outputs.t_shirt=data.issue_event_type_name;
outputs.start_date=data.issue.fields.customfield_10502;
outputs.health=data.issue.fields.customfield_10911.value;
outputs.commited_status=data.issue.fields.customfield_11629.value;
outputs.end_date=data.issue.fields.customfield_10607;
outputs.t_shirt=data.issue.fields.customfield_11007.value;
outputs.review_notes=data.issue.fields.customfield_10942;
})(inputs, outputs);
logged to ouput variables and then the output variables mapped to fields in update statment
ANy asistance would be greatly appriciated for accomodating these NULL values.
Thanks in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2023 08:52 AM
Self Solved
Need to log the null value from the object to string, for the flow variable
Example:
var data=JSON.parse(inputs.payload);
gs.info(inputs.payload);
outputs.start_date=data.issue.fields.customfield_10502;
if (data.issue.fields.customfield_10911==null){
outputs.health = "";
} else {
outputs.health=data.issue.fields.customfield_10911.value;
}
Needs to log the null as an empty string and then it will map to clear the field accordingly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2023 08:52 AM
Self Solved
Need to log the null value from the object to string, for the flow variable
Example:
var data=JSON.parse(inputs.payload);
gs.info(inputs.payload);
outputs.start_date=data.issue.fields.customfield_10502;
if (data.issue.fields.customfield_10911==null){
outputs.health = "";
} else {
outputs.health=data.issue.fields.customfield_10911.value;
}
Needs to log the null as an empty string and then it will map to clear the field accordingly