Auto Set User/Team Lookup Field Value Using Power Automate In D365 - dynamics-crm

In my project I want to set the user/team lookup field value in Test table with power automate flow.
But I want to not set directly field value, I have one field which is in Account table(Field Name is User) which is also user/team lookup field. I want to set, when the Account table lookup field is user then set field value(As Account Table User) in Test table and when the Account table field value is team then set the same field value(As Account Table Team) in Test table.
Actually when I add Account table look up field is User and I have added expression in user and team respectively it was show the error as below.
My Expressions are:
1.for User: if(empty(outputs('Get_Account_Details')?['body/_new_user_value']),concat('systemusers(',outputs('Get_a_row_by_ID_-_Get_Account_Owner')?['body/_parentsystemuserid_value'],')'),outputs('User_is_user'))
For Team: if(empty(outputs('Get_Account_Details')?['body/_new_user_value']),'',outputs('Team_is_team'),)
If I use above expression for User and Account table User(Field) is user then It's properly work but when I use both expressions it was not work.
Currently my Account table field is team then,
I got the team and not getting User which is Correct but when I set this compose in field output it getting the error.
Anyone Help?

you will need to find out entity schema name of field _new_user_value If it is systemuser then set as systemuser, if not it is Team
For a Field _new_user_value_ you will have option in power automate as Entity Name, check that if it is Team or user and based on it you can perfrom setting value.

Related

Loading records into Dynamics 365 through ADF

I'm using the Dynamics connector in Azure Data Factory.
TLDR
Does this connector support loading child records which need a parent record key passed in? For example if I want to create a contact and attach it to a parent account, I upsert a record with a null contactid, a valid parentcustomerid GUID and set parentcustomeridtype to 1 (or 2) but I get an error.
Long Story
I'm successfully connecting to Dynamics 365 and extracting data (for example, the lead table) into a SQL Server table
To test that I can transfer data the other way, I am simply loading the data back from the lead table into the lead entity in Dynamics.
I'm getting this error:
Failure happened on 'Sink' side. ErrorCode=DynamicsMissingTargetForMultiTargetLookupField,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=,Source=,''Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Cannot find the target column for multi-target lookup field: 'ownerid'.
As a test I removed ownerid from the list of source columns it loads OK.
This is obviously a foreign key value.
It raises two questions for me:
Specifically with regards to the error message: If I knew which lookup it needed to use, how can I specify which lookup table it should validate against? There's no settings in the ADF connector to allow me to do this.
This is obviously a foreign key value. If I only had the name (or business key) for this row, how can I easily lookup the foreign key value?
How is this normally done through other API's, i.e. the web API?
Is there an XRMToolbox addin that would help clarify?
I've also read some posts that imply that you can send pre-connected data in an XML document so perhaps that would help also.
EDIT 1
I realised that the lead.ownertypeid field in my source dataset is NULL (that's what was exported). It's also NULL if I browse it in various Xrmtoolbox tools. I tried hard coding it to systemuser (which is what it actually is in the owner table against the actual owner record) but I still get the same error.
I also notice there's a record with the same PK value in systemuser table
So the same record is in two tables, but how do I tell the dynamics connector which one to use? and why does it even care?
EDIT 2
I was getting a similar message for msauto_testdrive for customerid.
I excluded all records with customerid=null, and got the same error.
EDIT 2
This link appears to indicate that I need to set customeridtype to 1 (Account) or 2 (Contact). I did so, but still got the same error.
Also I believe I have the same issue as this guy.
Maybe the ADF connector suffers from the same problem.
At the time of writing, #Arun Vinoth was 100% correct. However shortly afterwards there was a documentation update (in response to a GitHub I raised) that explained how to do it.
I'll document how I did it here.
To populate a contact with against a parent account, you need the parent accounts GUID. Then you prepare a dataset like this:
SELECT
-- a NULL contactid means this is a new record
CAST(NULL as uniqueidentifier) as contactid,
-- the GUID of the parent account
CAST('A7070AE2-D7A6-EA11-A812-000D3A79983B' as uniqueidentifier) parentcustomerid,
-- customer id is an account
'account' [parentcustomerid#EntityReference],
'Joe' as firstname,
'Bloggs' lastname,
Now you can apply the normal automapping approach in ADF.
Now you can select from this dataset and load into contact. You can apply the usual automapping approach, this is: create datasets without schemas. Perform a copy activity without mapping columns
This is the ADF limitation with respect to CDS polymorphic lookups like Customer and Owner. Upvote this ADF idea
Workaround is to use two temporary source lookup fields (owner team and user in case of owner, account and contact in case of customer) and with parallel branch in a MS Flow to solve this issue. Read more, also you can download the Flow sample to use.
First, create two temporary lookup fields on the entity that you wish to import Customer lookup data into it, to both the Account and Contact entities respectively
Within your ADF pipeline flow, you will then need to map the GUID values for your Account and Contact fields to the respective lookup fields created above. The simplest way of doing this is to have two separate columns within your source dataset – one containing Account GUID’s to map and the other, Contact.
Then, finally, you can put together a Microsoft Flow that then performs the appropriate mapping from the temporary fields to the Customer lookup field. First, define the trigger point for when your affected Entity record is created (in this case, Contact) and add on some parallel branches to check for values in either of these two temporary lookup fields
Then, if either of these conditions is hit, set up an Update record task to perform a single field update, as indicated below if the ADF Account Lookup field has data within it

Fetch value of a field from one entity to second entity based on the lookup field selected in second entity using Fetch XML

I am new to CRM. I have a requirement where I have an "account" entity and a "contact" entity. In contact form I have a lookup field for searching account name which is stored in account entity. When I select an organization through lookup, the contact number of that organization should be fetched and saved in another field in contact form. I need to do it with fetch XML.
Option 1: You can do a no-code solution by mapping fields between account & contact.
Option 2: If you don't want a physical copy of field value in both entity, use Quick view form of Account lookup to just display the fields in contact without storing redundant data.
Option 3: If you still want to store the value onchange of account, retrieve it & set it in contact field. This step by step guide will help you to build fetchxml & use it in JS. Your question doesn't say if you are stuck in query or any error.

Upsert fields must be defined as unique External ID fields in Salesforce - Heroku Connect

I got this error:
Error:Read-write mappings require an upsert field for syncing. Upsert fields must be defined as unique External ID fields in Salesforce.More Info...
Warning:Fields needed for insertion to Salesforce need to be mapped: LastName
after changing plan from Developer to Professional when creating mapping in Heroku for Contact object.
Even after chaning to plan higher than Professional, the same error appears.
It was possible with Developer plan.
When you do an Upsert operation, you can either specify the Salesforce record Id as the unique identifier, or you can specify a custom field. If you use a custom field, then that field must be marked as Unique inside Salsesforce. You can do this by going to Setup and editing the field. There's a checkbox to mark it as Unique and as an External Id.
Also, it looks like you're not populating all required fields, specifically: LastName on the Contact.

Link Lookup Table to Account Name Field

In CRM Online I need to link the Account Name field in the Account entity to a lookup table of imported and approved company names. The goal is to require users to pick from an approved list instead of letting them make up a company account name. I know there is an Account Name lookup in Contacts which uses existing Account Name records, but I need the lookup in the Account entity. Thanks for any tips.
If you are referring to a different entity as LookupTable, then create a relationship between Account ans the Lookup Table entity. After that you can use that entity as Lookup attribute in Account entity
CRM renders a Lookup control for a 1:N relationship. What you are trying achieve would fall more into a data validation scenario where users can enter account names from a pre-set list of names.
You can leverage a new event introduced in CRM 2016 - addOnKeyPress which can be easily used to build an autocomplete feature which would be more inline with what you are trying to achieve. If a user doesn't "pick" a value instead types anything in disregarding the autocomplete use attribute control's setNotification to set an error message which would invalidate the save preventing the user from saving the record.

Database validation for a user input text field in oracle UCM | WCC

I'm new to Oracle WCC.
In Oracle WCC/UCM( Universal content management), I have one table named CreateStudent has 2 columns StudentID and StudentName.
One metadata custom field XXStudent_Info for which user will pass the value on Checkin page.
We need to validate the value of XXStudent_Info to database column StudentID, if it matches then checkin possible otherwise restrict on checkin itself.
How can i do this in WCC via out of the box functionality or will i have to create a custom service/query for this DB validation. Please give steps in detail
Is the custom metadata field XXStudent_Info based on an option list which uses a view which is based on the table? If so, you should be able to restrict it to only valid values.

Resources