-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting Lookup Fields - Guidance needed #25
Comments
We will surely add an example to the codebase. If you want a quick one, here it is:
Thanks. |
It would be more semantically correct (and in the spirit of .NET implementation) to use an EntityReference:
|
Hi @wizardist, thank you very much for your response. I was able to set the required Lookup-Fields, but I needed to change an if-check in your code which obviously shouldn't be necessary. php-crm-toolkit/src/Entity.php Line 280 in 5eac907
The line above checks if my EntityReference-Object is an instance of self (=Entity-Object).
Thanks |
Yeah, this should be fixed. |
When calling the entity method while passing a KeyAttribute, the script will fail in Entity:1297 Catchable Fatal Error: Object of class AlexaCRM\CRMToolkit\KeyAttributes could not be converted to string |
@sfenne can you provide a snippet of code that causes the error? |
@georged sure. I'm trying to lookup an account by its accountnumber.
|
@sfenne |
@georged the accountnumber exists, but I'm not too familiar with CRM. If I replace the KeyAttributes $contactKey with the GUID of an account, I get full account result. An array with all the values, which includes the accountnumber key and value. Is it possible I need to do further actions in CRM to "enable" accountnumber as a lookupable field via API? Thanks |
you need to create alternate key in CRM. Note that it's not going to create a lookup which is CRM construct for a foreign key, it will simply allow you to retrieve the record by account number. If you have any further questions, I recommend creating a separate thread as your question has little to do with lookup fields and is about alternate keys. Thanks |
077ae7e now allows setting EntityReference as a lookup value. Closing this one. |
I am trying to create a Case by using https://github.com/AlexaCRM/php-crm-toolkit. When I am using following code getting following error: Fatal error: Uncaught AlexaCRM\CRMToolkit\SoapFault: Contact With Id = 9f3065e3-64bc-e811-a94c-000d3a4e761d Does Not Exist in \vendor\alexacrm\php-crm-toolkit\src\Client.php on line 1159
|
@ziyaindia are you sure such contact really exists? The fault is coming from CRM, and that's CRM telling you that it doesn't exist. |
How can i come to know which contact id i can use for this? |
@ziyaindia you're trying to create a case for a contact. Surely, you need to know who the contact is. How would you like to identify the contact you want to create a case for? It can be hard-coded (you need to find out guid of that contact from CRM), or you could run fetchxml with some conditions to find a contact, or you could use alternate keys. Finally, you can just create a contact before creating a case. Whatever you want. But you need to have a valid contact id, this is something that we can't help you with. |
I used Email link and get following link in my compose email window: Eric Williams I took - 9F3065E3-64BC-E811-A94C-000D3A4E761D this id for contact |
That's id of a systemuser (etc=8), not of a contact. |
How i can find the contact id in my php script?Please help me I stuck too much. |
What contact do you want the case created for?! |
When someone submit contact us query from my website then I want to create a case in CRM |
So who would be a contact in this scenario? Are you going to prompt them for first/last name and create contact at the same time? Then instead of
you'd want something like
Thanks |
Thanks for replying If I already having a contact in my CRM with email id 'john.doe@example.com', How can i get contact id for this? Regards, |
Ziya, you would have to use fetchxml to search and locate the contact. Thanks |
Thanks for all your help Now I am creating note for a lead. Note is not creating under leads Using following code foe this $leadId = $lead->create(); $note = $service->entity('annotation'); ';print_r($incident);echo ''; $note->objectid = new EntityReference( 'lead', $leadId ); $note->objecttypecode = 'lead'; $note->subject = 'Note is Created From Lead'; $note->documentbody = $insuranceFile; $note->mimetype = "text/plain"; $note->notetext = $note; $note->filename = $insuranceFileName; //$incident->ID = $guid;//contactid responsiblecontactid primarycontactid $noteId = $note->create(); Thanks, |
First of all I wanted to thank you for this very helpful project, it makes the whole Dynamics CRM communication a lot easier!
I successfully tested and implemented the code to create and update a new contact (lead in my case).
The only thing I'm missing now is 'to set lookup values', which should be retrieved as GUID from the org.
I did not find an example howto achieve this task, so I was hoping that someone would be so nice to show me / point me to right implementation.
Thanks in advance!
The text was updated successfully, but these errors were encountered: