cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Regular Visitor

Planner: create new task/update task details - how to handle priority field or task field which is empty

Hello community, 

 

I have an excel sheet to prefill planner tasks which works , if most fields are filled. If I leave priority blank , an error will be thrown.  In order to proceed , I temporarily do not assign it which is not a solution.

Now I have a problem if the items for the checklist are blank . I get the following error message if I look into output:

{"statusCode":400,"headers":{"request-id":"2f4ef822-1d25-4afb-b3d5-4e083c2a414c","client-request-id":"2f4ef822-1d25-4afb-b3d5-4e083c2a414c","x-ms-ags-diagnostic":"{\"ServerInfo\":{\"DataCenter\":\"West Europe\",\"Slice\":\"SliceC\",\"Ring\":\"5\",\"ScaleUnit\":\"000\",\"RoleInstance\":\"AGSFE_IN_57\"}}","Strict-Transport-Security":"max-age=31536000","Timing-Allow-Origin":"*","x-ms-apihub-cached-response":"true","Cache-Control":"private","Date":"Sun, 24 Jan 2021 19:42:33 GMT","Content-Length":"1500","Content-Type":"application/json"},"body":{"error":{"code":"","message":"Schema validation has failed. Validation for field 'Checklist.ChecklistItem.Title', on entity 'TaskDetails' has failed: The field is null, empty or consists entirely of whitespace characters.\r\nValidation for field 'Checklist.ChecklistItem.Title', on entity 'TaskDetails' has failed: The field cannot be shorter than 1 characters.\r\nValidation for field 'Checklist.ChecklistItem.Title', on entity 'TaskDetails' has failed: The field is null, empty or consists entirely of whitespace characters.\r\nValidation for field 'Checklist.ChecklistItem.Title', on entity 'TaskDetails' has failed: The field cannot be shorter than 1 characters.\r\nValidation for field 'Checklist.ChecklistItem.Title', on entity 'TaskDetails' has failed: The field is null, empty or consists entirely of whitespace characters.\r\nValidation for field 'Checklist.ChecklistItem.Title', on entity 'TaskDetails' has failed: The field cannot be shorter than 1 characters.\r\nValidation for field 'Checklist.ChecklistItem.Title', on entity 'TaskDetails' has failed: The field is null, empty or consists entirely of whitespace characters.\r\nValidation for field 'Checklist.ChecklistItem.Title', on entity 'TaskDetails' has failed: The field cannot be shorter than 1 characters.","innerError":{"date":"2021-01-24T19:42:34","request-id":"2f4ef822-1d25-4afb-b3d5-4e083c2a414c","client-request-id":"2f4ef822-1d25-4afb-b3d5-4e083c2a414c"}}}}

So how can I handle the error if priority is empty and the checklist item title is empty as well? 

 

Thanks in advance, best regards, Armin

1 ACCEPTED SOLUTION

Accepted Solutions
Super User II
Super User II

Hello @arminh ,

you can use if(...) expression that will check if the 'Priority' column has a value, and use the value only if it's not empty.

if(equals(items('Apply_to_each_2')?['Priority'],''),null,items('Apply_to_each_2')?['Priority'])

Notes:
items('Apply_to_each_2')?['Priority'] is the Excel value with priority
equals(...) will compare if the priority is empty (= '')
- if true: use null value for the priority
- if false: use the actual priority from Excel

image.png

For the checklist you can follow either similar logic, or you can add a 'Condition' action before the 'Update task details' to check if there's any checklist. If there is, then update it, if not, then update the task without a checklist.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ ... and if you like my response, you might like also the tips and solutions on my Power Automate related blog ]

View solution in original post

1 REPLY 1
Super User II
Super User II

Hello @arminh ,

you can use if(...) expression that will check if the 'Priority' column has a value, and use the value only if it's not empty.

if(equals(items('Apply_to_each_2')?['Priority'],''),null,items('Apply_to_each_2')?['Priority'])

Notes:
items('Apply_to_each_2')?['Priority'] is the Excel value with priority
equals(...) will compare if the priority is empty (= '')
- if true: use null value for the priority
- if false: use the actual priority from Excel

image.png

For the checklist you can follow either similar logic, or you can add a 'Condition' action before the 'Update task details' to check if there's any checklist. If there is, then update it, if not, then update the task without a checklist.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ ... and if you like my response, you might like also the tips and solutions on my Power Automate related blog ]

View solution in original post

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (30,489)