cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

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
Highlighted
Community Support
Community Support

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
Highlighted
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.
Highlighted
Community Support
Community Support

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
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (3,935)