cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dexx3336
Helper II
Helper II

Not able to create the attachment regarding any entity

Hi All,

The code which was running earlier for creating the attachment in CRM from canvas app is not running now.

 

below is code snippet:

 

Patch(
Notes,
Defaults(Notes),
{
subject: TextInputTitle.Text,
notetext: TextInputDescription.Text,

_objectid_value : BrowseGallery1.Selected.accountid,
objecttypecode : "accounts",

filename: First(CameraImage).Filename,
documentbody: If(
StartsWith(
First(CameraImage).fileBody,
"data:image"
),
Replace(
First(CameraImage).fileBody,
1,
Len(
Left(
First(CameraImage).fileBody,
Find(
",",
First(CameraImage).fileBody
)
)
),
""
),
First(CameraImage).fileBody
)
}
)

What is wrong in above code? I also tried by using  "_objectid_type" instead of "objecttypecode" but didn't work for me. Smiley Sad 

 

Thanks in advance.

 

 

13 REPLIES 13

Hi @Sachinbansal , any links for this tutorial?

Hi @finsg 

 

Below link would help you on how to create flow and call it from PowerApps passing paramaters.

 

https://sachinbansal.blog/2018/04/05/dynamics-365-powerapp-microsoft-flow-sample-app-from-scratch/

 

Specific to notes creation, you can use below on button click or whatever:

'PowerApps-CreatenotesinD365'.Run(txtNoteTitle.Text, txtNoteDescription.Text, Regarding)

 

Here regarding would be guid of record to add note to.

 

Attached is snapshot of how flow will look like. Make sure to map yellow highlighted fields in flow.

Hey

 

I came here looking for the solution to my problem, adding attachments not just notes, but have resolved the issue and I hope my blog helps others.

 

https://linked365.home.blog/2019/05/11/creating-attachments-in-d365/

I found an easier way to patch notes to work, use Regarding:GUID(<record-guid>) instead...
Read more here:
https://powerusers.microsoft.com/t5/Creating-Apps/Patch-photo-s-to-Notes-Entity-in-Dynamics/m-p/3205...

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,992)