- Joined
- Jan 11, 2024
- Messages
- 7
- Reaction score
- 4
We are using the custom CRM integration to do a contact lookup for contacts and companies. This all works correctly.
We are now looking to add Call Journaling but need to provide the ContactID if it's a contact or a DivisionID if it's a company in the rest post to the CRM.
I was hoping to use the EntityType from the lookup by phone number scenario but this only seems to return "Contacts" regardless of where the number is found.
Is there a way to do this?
Code trimmed
We are now looking to add Call Journaling but need to provide the ContactID if it's a contact or a DivisionID if it's a company in the rest post to the CRM.
I was hoping to use the EntityType from the lookup by phone number scenario but this only seems to return "Contacts" regardless of where the number is found.
Is there a way to do this?
XML:
....
<Scenarios>
<Scenario Id="" Type="REST" EntityId="contact" EntityOrder="company/contact">
<Request SkipIf="" Url="https://crm-odata-v1.prospect365.com/Contacts?$filter=contains(PhoneNumber,'[Number]') or MobilePhoneNumber eq '[Number]'&$select=ContactId,Forename,Surname,Email,PhoneNumber,MobilePhoneNumber,RecordLink&$expand=Division($select=Name)&$orderby=ContactID desc" MessagePasses="0" RequestEncoding="UrlEncoded" RequestType="Get" ResponseType="Json">
<Headers>
<Value Key="Authorization" Passes="0" Type="String">Bearer [Bearer Token]</Value>
</Headers>
</Request>
<Rules>
<Rule Type="Any">value.ContactID</Rule>
</Rules>
<Variables>
<Variable Name="ContactID" Path="value.ContactId">
<Filter />
</Variable>
<Variable Name="FirstName" Path="value.Forename">
<Filter />
</Variable>
<Variable Name="LastName" Path="value.Surname">
<Filter />
</Variable>
<Variable Name="CompanyName" Path="value.Division.Name">
<Filter />
</Variable>
<Variable Name="Email" Path="value.Email">
<Filter />
</Variable>
<Variable Name="PhoneNumber" Path="value.PhoneNumber">
<Filter />
</Variable>
<Variable Name="PhoneMobile" Path="value.MobilePhoneNumber">
<Filter />
</Variable>
</Variables>
<Outputs Next="" AllowEmpty="false">
<Output Type="ContactID" Passes="0" Value="[ContactID]" />
<Output Type="FirstName" Passes="0" Value="[FirstName]" />
<Output Type="LastName" Passes="0" Value="[LastName]" />
<Output Type="CompanyName" Passes="0" Value="[CompanyName]" />
<Output Type="Email" Passes="0" Value="[Email]" />
<Output Type="PhoneMobile" Passes="0" Value="[PhoneMobile]" />
<Output Type="ContactUrl" Passes="0" Value="https://crm.prospect365.com/view/Contact/[ContactID]" />
<Output Type="EntityId" Passes="0" Value="[ContactID]" />
<Output Type="EntityType" Passes="0" Value="contact" />
<Output Type="PhoneBusiness" Passes="0" Value="[PhoneNumber]" />
</Outputs>
</Scenario>
<Scenario Id="" Type="REST" EntityId="company" EntityOrder="company/contact">
<Request Url="https://crm-odata-v1.prospect365.com/Divisions?$filter=contains(PhoneNumber,'[Number]')&$select=DivisionId,Name,PhoneNumber" MessagePasses="0" RequestEncoding="UrlEncoded" RequestType="Get" ResponseType="Json">
<Headers>
<Value Key="Authorization" Passes="0" Type="String">Bearer [Bearer Token]</Value>
</Headers>
</Request>
<Rules>
<Rule Type="Any">value.DivisionID</Rule>
</Rules>
<Variables>
<Variable Name="DivisionID" Path="value.DivisionID">
<Filter />
</Variable>
<Variable Name="CompanyName" Path="value.Name">
<Filter />
</Variable>
<Variable Name="PhoneNumber" Path="value.PhoneNumber">
<Filter />
</Variable>
</Variables>
<Outputs AllowEmpty="false">
<Output Type="ContactID" Passes="0" Value="[DivisionID]" />
<Output Type="CompanyName" Passes="0" Value="[CompanyName]" />
<Output Type="ContactUrl" Passes="0" Value="https://crm.prospect365.com/view/SingleCompany/[DivisionID]" />
<Output Type="EntityId" Passes="0" Value="[DivisionID]" />
<Output Type="EntityType" Passes="0" Value="company" />
<Output Type="PhoneBusiness" Passes="0" Value="[PhoneNumber]" />
</Outputs>
</Scenario>
<Scenario Id="LookupByEmail" Type="REST">
<Request Url="https://crm-odata-v1.prospect365.com/Contacts?$filter=Email eq '[Email]'&$select=ContactId,Forename,Surname,Email,PhoneNumber,MobilePhoneNumber&$expand=Division($select=Name)" MessagePasses="0" RequestEncoding="UrlEncoded" RequestType="Get" ResponseType="Json">
<Headers>
<Value Key="Authorization" Passes="0" Type="String">Bearer [Bearer Token]</Value>
</Headers>
</Request>
<Rules>
<Rule Type="Any">value.ContactID</Rule>
</Rules>
<Variables>
<Variable Name="ContactID" Path="value.ContactId">
<Filter />
</Variable>
<Variable Name="FirstName" Path="value.Forename">
<Filter />
</Variable>
<Variable Name="LastName" Path="value.Surname">
<Filter />
</Variable>
<Variable Name="CompanyName" Path="value.Division.Name">
<Filter />
</Variable>
<Variable Name="Email" Path="value.Email">
<Filter />
</Variable>
<Variable Name="PhoneMobile" Path="value.MobilePhoneNumber">
<Filter />
</Variable>
<Variable Name="PhoneNumber" Path="value.PhoneNumber">
<Filter />
</Variable>
</Variables>
<Outputs AllowEmpty="false">
<Output Type="ContactID" Passes="0" Value="[ContactID]" />
<Output Type="FirstName" Passes="0" Value="[FirstName]" />
<Output Type="LastName" Passes="0" Value="[LastName]" />
<Output Type="CompanyName" Passes="0" Value="[CompanyName]" />
<Output Type="Email" Passes="0" Value="[Email]" />
<Output Type="PhoneMobile" Passes="0" Value="[PhoneMobile]" />
<Output Type="ContactUrl" Passes="0" Value="https://crm.prospect365.com/view/Contact/[ContactID]" />
<Output Type="EntityId" Passes="0" Value="[ContactID]" />
<Output Type="EntityType" Passes="0" Value="contact" />
<Output Type="PhoneBusiness" Passes="0" Value="[PhoneNumber]" />
</Outputs>
</Scenario>
<Scenario Id="ReportCall" Type="REST">
<Request SkipIf="[IIf([ReportCallEnabled]!=True||[EntityId]=="",True,[IIf([CallType]!=Inbound,True,False)])]" Url="https://crm-odata-v1.prospect365.com/Notepads" MessagePasses="0" RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
<Headers>
<Value Key="Authorization" Passes="0" Type="String">Bearer [Bearer Token]</Value>
</Headers>
<PostValues Key="">
<Value Key="ContactId" If="[EntityType]==contact" Passes="1" Type="String">[EntityId]</Value>
<Value Key="DivisionId" If="[EntityTyped]==company" Passes="1" Type="String">[EntityId]</Value>
<Value Key="DateTime" Passes="1" Type="String">[[CallStartTimeUTC].ToString("yyyy-MM-ddTHH:mm:sssZ")]</Value>
<Value Key="Text" Passes="2" Type="String">[[InboundCallText]]</Value>
</PostValues>
</Request>
<Variables />
....