Hi
@SMS-Martin,
The problem is that Dataverse is receiving:
/accounts()
This means the GUID value is blank at runtime.
Since you are using:
"$expand": "xxx_Account($select=name,emailaddress1)"
the Account GUID is not included in the expanded object, so this expression returns empty:
items('Apply_to_each')?['_sms_account_value']
To fix this, include the Account ID in your expand:
"$expand": "xxx_Account($select=accountid,name,emailaddress1)"
Then, use the following for the Regarding field:
"item/regardingobjectid_account_task@odata.bind": "/accounts(@{items('Apply_to_each')?['xxx_Account']?['accountid']})"
This should correctly link the created task with the Account record timeline.
I hope this helps! If you found the reply useful, please consider giving it a thumbs up. If it resolved your issue, mark it as the Verified Answer.