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")
Solved! Go to Solution.
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,
@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
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,
User | Count |
---|---|
136 | |
135 | |
78 | |
72 | |
69 |
User | Count |
---|---|
222 | |
136 | |
78 | |
60 | |
54 |