cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
arminh
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
tom_riha
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. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

1 REPLY 1
tom_riha
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. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

Helpful resources

Announcements
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (81,738)