cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
opticshrew2
Level: Powered On

Dynamics 365 Patching to Lookup Column

Hi all,

 

I have a Dynamics 365 instance with a custom entity. I want to create a PowerApps form that patches to the entity. The entity contains a look field named "Team" that links to the "System Teams" entity. There's also another lookup field that links with "Account". Below is my code:

 

ClearCollect(
    Submission,
    {
        BSC_Name : Name.Text,
        BSC_Customer : SelectedAccount.Account,
        BSC_Background : Background.Text,
        BSC_Scope : Scope.Text,
        BSC_ExpectedCloseDate : Deadline.SelectedDate,
        BSC_RaisedBy : Value(Department.Selected.ID),
        BSC_SuggestedTeam : Team.Selected.'System Teams'
    }
);
Set(LocalSubmission, First(Submission));
Set(TeamRecord, LookUp('System Teams', 'System Teams' = LocalSubmission.BSC_SuggestedTeam));
Patch(
    'Records',
    Defaults('Records'),
    {
        Name : LocalSubmission.BSC_BluespaceName,
        testexc_bluespacename : LocalSubmission.BSC_Name, //Legacy Field
        Customer : GUID(LocalSubmission.BSC_Customer),
        'Opportunity Background (Include contact name)' : LocalSubmission.BSC_Background, //Legacy Field
        Background : LocalSubmission.BSC_Background,
        testexc_opportunitydescription : LocalSubmission.BSC_Scope, //Legacy Field
        Scope : LocalSubmission.BSC_Scope,
        testexc_estclosedate : LocalSubmission.BSC_ExpectedCloseDate,
        testexc_departmentraisedby : LocalSubmission.BSC_RaisedBy, //Legacy Field
		
        testexc_destinationteam : TeamRecord
		
    }
);
Navigate(Complete,ScreenTransition.None)

It appears that if I exclude "testexc_destinationteam : TeamRecord" everything works okay. If I configure in the same form as the "Account" entry it states a record is expected not a GUID. If I keep it like the above it states that a value must be provided for item.


Does anyone have any idea why this is happening?

 

Thanks,

J

 

 

 

4 REPLIES 4
PavanKumar
Level 8

Re: Dynamics 365 Patching to Lookup Column

Hi,

 

Are you sure its getting the record - Set(TeamRecord, LookUp('System Teams', 'System Teams' = LocalSubmission.BSC_SuggestedTeam));

 

Once check with some static value like First('System Teams').

 

If this answers your questions give Thumbs up and mark it as verified.

Regards,

Pavan Kumar Garlapati

opticshrew2
Level: Powered On

Re: Dynamics 365 Patching to Lookup Column

Hi @PavanKumar 

 

Yes, it's pulling the correct record. I've checked the variables in the app and can see that this is being populated.

 

Thanks,

J

PavanKumar
Level 8

Re: Dynamics 365 Patching to Lookup Column

Hi,

 

As mentioned once double check the column name if you are correctly mapping to Lookup column also once try with First('System Teams') and see if its working.

 

If this answers your question mark it as verified and give thumbs up

Regards,

Pavan Kumar Garlapati

opticshrew2
Level: Powered On

Re: Dynamics 365 Patching to Lookup Column

Hi @PavanKumar 

 

I've tried your suggestion:

ClearCollect(
    TeamRecordCollection,
    Filter(
        'System Teams',
        'System Teams' = LocalSubmission.BSC_SuggestedTeam
    )
);
Patch(
    'Bluespace records',
    Defaults('Bluespace records'),
    {
        Name : LocalSubmission.BSC_Name,
        testexc_bluespacename : LocalSubmission.BSC_Name, //Legacy Field
        Customer : GUID(LocalSubmission.BSC_Customer),
        'Opportunity Background (Include contact name)' : LocalSubmission.BSC_Background, //Legacy Field
        Background : LocalSubmission.BSC_Background,
        testexc_opportunitydescription : LocalSubmission.BSC_Scope, //Legacy Field
        Scope : LocalSubmission.BSC_Scope,
        testexc_estclosedate : LocalSubmission.BSC_ExpectedCloseDate,
        testexc_departmentraisedby : LocalSubmission.BSC_RaisedBy, //Legacy Field
        testexc_destinationteam : First(TeamRecordCollection)
    }
);

However I'm getting the same issue. I had to create a collection as I couldn't use First() over a variable.

 

Thanks,

J

 

 

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 245 members 4,044 guests
Please welcome our newest community members: