cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nparent
Level: Powered On

Unable to attach a note to a lead just created with a pach

I have an application who create a lead and attache a note with an image take on camera.      It seem to correctly create the lead, but when it's time to create the note, this message apear :   unable to find the Lead with ID :  xxxxxxxxx

 

So I see it's really creating the lead... the Guid returned is the good one...   maybe synchronisation issue ?    

 

You have to note that it's working in an other instance (using english name instead of french), but not on the french one....   

 

ClearCollect(
leadCollection;
Defaults(Leads);
Patch(
Leads;
{Topic: topic.Text}
)
);;
Patch(
Notes;
Defaults(Notes);
{
subject: topic.Text;
notetext: topic.Text;
_objectid_value: Last(leadCollection).leadid;
_objectid_type: "leads";
filename: "lead.png";
documentbody: If(
StartsWith(
First(Image).fileBody;
"data:image/png;base64,"
);
Replace(
First(Image).fileBody;
1;
22;
""
);
First(Image).fileBody
)
}
);;
Notify("Enregistrement Complété ! N'oublie pas d'aller mettre à jour dans Dynamics")

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Unable to attach a note to a lead just created with a pach

Hi @nparent ,

Based on the error message that you mentioned, It seems to tell that there is something wrong with the value you provided for the _objectid_value property in your Patch function.

I agree with @RandyHayes 's thought almost. Based on the formula that you provided, I think there is something wrong with it. Please modify your formula as below:

ClearCollect(
       leadCollection;
       Patch(              /* <-- Modify your formula here */
             Leads;
             Defaults(Leads);   /*<-- Type Defaults() function here */
             {Topic: topic.Text}
       )
);;
Refresh('Leads'); /* <-- Add this formula */
Patch(
Notes;
Defaults(Notes);
{
subject: topic.Text;
notetext: topic.Text;
_objectid_value: Last(leadCollection).leadid;
_objectid_type: "leads";
filename: "lead.png";
...
...
);;
Notify("Enregistrement Complété ! N'oublie pas d'aller mettre à jour dans Dynamics")

If the issue still exists, please consider take a try to re-create a new connection to your Entities within your app, then try above solution again, check if the issue is solved.

 

Best regards,

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

View solution in original post

2 REPLIES 2
Super User
Super User

Re: Unable to attach a note to a lead just created with a pach

@nparentat a glance - it doesn't look like you are actually creating the Leads record.  Your first statement will create a collection called leadCollection, that will have the first record as the default values and nothing for the second (as I believe your Patch statement would fail).

Perhaps what you are looking for is something like this:

   ClearCollect(leadCollections; Patch(Leads; Defaults(Leads); {Topic: topic.Text}));;

 

Hopefuly that will help some

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Community Support Team
Community Support Team

Re: Unable to attach a note to a lead just created with a pach

Hi @nparent ,

Based on the error message that you mentioned, It seems to tell that there is something wrong with the value you provided for the _objectid_value property in your Patch function.

I agree with @RandyHayes 's thought almost. Based on the formula that you provided, I think there is something wrong with it. Please modify your formula as below:

ClearCollect(
       leadCollection;
       Patch(              /* <-- Modify your formula here */
             Leads;
             Defaults(Leads);   /*<-- Type Defaults() function here */
             {Topic: topic.Text}
       )
);;
Refresh('Leads'); /* <-- Add this formula */
Patch(
Notes;
Defaults(Notes);
{
subject: topic.Text;
notetext: topic.Text;
_objectid_value: Last(leadCollection).leadid;
_objectid_type: "leads";
filename: "lead.png";
...
...
);;
Notify("Enregistrement Complété ! N'oublie pas d'aller mettre à jour dans Dynamics")

If the issue still exists, please consider take a try to re-create a new connection to your Entities within your app, then try above solution again, check if the issue is solved.

 

Best regards,

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

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,496)