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

Create a calendar entry anytime a new record or an updated record is made in a SQL table

I have a SQL table that gets updated every night with instructor's schedule.  it has many fields but the main fields are:

 

  1. EventName
  2. OrderID
  3. TeacherName
  4. ProgramName
  5. SchoolName
  6. StartDateTime
  7. EndDateTime
  8. CreateDate
  9. UpdateDate

 

I created a flow that writes that information from SQL to an Outlook Calendar anytime a new event is added to the table and that works great, I've tested it and have no problem. The problem i do have is that sometimes the events are changed or deleted so i need to update the event on the outlook calendar to either update with the new date or remove the event if it has been deleted.  i cant get this to work. this is what i did . 

 

The part on the left (Create) works Fine . the part on the left fails every time . i think it may have to do with the ID because i don't understand how to get the ID of an existing calendar item to update . but am not sure. 

 

the error says bad request and this is the output 

 

{
"statusCode": 400,
"headers": {
"Pragma": "no-cache",
"x-ms-request-id": "1bb1d023-7338-4cf9-88bd-2ada11604923",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
"X-Content-Type-Options": "nosniff",
"X-Frame-Options": "DENY",
"Timing-Allow-Origin": "*",
"x-ms-apihub-cached-response": "false",
"Cache-Control": "no-store, no-cache",
"Date": "Fri, 23 Aug 2019 06:59:31 GMT",
"Set-Cookie": "ARRAffinity=48c1aab958578a8842b7561455dec5acf0c7064c05bffd287bd301d60aed5721;Path=/;HttpOnly;Domain=office365-cus.azconn-cus.p.azurewebsites.net",
"Content-Length": "231",
"Content-Type": "application/json",
"Expires": "-1"
},
"body": {
"status": 400,
"message": "Id is malformed.\r\nclientRequestId: b0fe6676-b085-4c67-8208-1477cf1d544e\r\nserviceRequestId: 1bb1d023-7338-4cf9-88bd-2ada11604923",
"source": "office365-cus.azconn-cus.p.azurewebsites.net"
}
}

 

Flow.png

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @lalmonte 

 

So the Get Event action expects you to provide the event ID for the particular event that you want to get the details of. This event ID is an automaticlly created guid that is genearated when the event is created in Outlook.

 

Two ways you can do this is: 

1. You need to add a column to the SQL table named as event ID and once the create event action is complete, add another action to update SQL and update the current sql item with the event ID from the Create Event action. this way you can use this event ID to get the relevant event in the No branch as and when needed. 

 

2. Use the Get Events action and here construct the filter query with the subject eq 'whatever subject you put from sql' and this will return the list of events with that particular subject that was provided (basically this should return only one item in a list as the subject would be unique). fww.PNG

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

2 REPLIES 2

Hi @lalmonte 

 

So the Get Event action expects you to provide the event ID for the particular event that you want to get the details of. This event ID is an automaticlly created guid that is genearated when the event is created in Outlook.

 

Two ways you can do this is: 

1. You need to add a column to the SQL table named as event ID and once the create event action is complete, add another action to update SQL and update the current sql item with the event ID from the Create Event action. this way you can use this event ID to get the relevant event in the No branch as and when needed. 

 

2. Use the Get Events action and here construct the filter query with the subject eq 'whatever subject you put from sql' and this will return the list of events with that particular subject that was provided (basically this should return only one item in a list as the subject would be unique). fww.PNG

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

v-bacao-msft
Community Support
Community Support

 

Hi @lalmonte ,

 

The ID required here is automatically created by the system during the creation of the event, regardless of the Sql table.

Please consider using Get calendar view of events (V3) action to filter out the corresponding event, and then update or delete the specified event according to the type of operation.

Image reference:

25.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (5,641)