cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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 III
Super User III

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (4,193)