Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

How to enter value for Dirpartytable. instancerelationshiptype through code .

Posted on by

Hello,

I have a requirement to enter the value of dirpartytable.instancerelationshiptype via code.

I tried with following lines but getting below error.

DirPartyTable.overwriteSystemfields(true);
Dirpartytable.Instancerelationshiptype = enum2int(dirpartytype::person); 

DirPartyTable.overwriteSystemfields(true);
Dirpartytable.Instancerelationshiptype = '2975';

pastedimage1577990504891v1.png

Thanks

Mav

  • Mav Profile Picture
    Mav on at
    RE: How to enter value for Dirpartytable. instancerelationshiptype through code .

    Any solution to this issue would be appreciated.

  • Mav Profile Picture
    Mav on at
    RE: How to enter value for Dirpartytable. instancerelationshiptype through code .

    Already tried DirPartyTable.overwriteSystemfields(true); as shown in line 1 and line 4 of my code but no luck with that.

  • Verified answer
    Satish Panwar Profile Picture
    Satish Panwar 14,645 on at
    RE: How to enter value for Dirpartytable. instancerelationshiptype through code .

    Give this a try:

    community.dynamics.com/.../how-to-update-the-system-fields-of-the-table-like-modifieddatetime

    Also why are you trying to do this from code ? Are you creating DirParty records. Try to debug standard process and see what's going on.

  • Mav Profile Picture
    Mav on at
    RE: How to enter value for Dirpartytable. instancerelationshiptype through code .

    Thanks for your response Satish, tried all the options & got the same error.

    There is something in this column which is not allowing assignment.

  • Satish Panwar Profile Picture
    Satish Panwar 14,645 on at
    RE: How to enter value for Dirpartytable. instancerelationshiptype through code .

    Hi Mav,

    Give options below a try.

    partyRecord.InstanceRelationType  = DictTable::getRelationTypeFromTableName(tableStr(DirPerson))

    partyRecord.InstanceRelationType  = DictTable::getRelationTypeFromTableName(tableStr(DirOrganization))

    partyTable.InstanceRelationType = DirPartyTable::type2RelationType(DirPartyType::Person)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans