Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

JS for related record filtering in BPF - Dynamics 365 online

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi, My requirement goes like this: 

I have a Quote lookup on Opportunity form body and on the business process flow. I need to filter the records of quote which come up in the lookup to only the records related to current opportunity and whose status is not revised. On the form body this is easily done through a JS and OOB related record filtering feature. But I need the same functionality on BPF as well. For this I have tried with JS and got the BPF filed control with: Xrm.Page.getControl("header_process_bc_refquoteid").getAttribute(). I need current record id of opportunity in the fetch query, but the code is giving an error of invalid argument. The query is something like: Get the quotes where status!=7 and oppId = current record id. Below is the code snippet. Pls help.

8765.js.PNG

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: JS for related record filtering in BPF - Dynamics 365 online

    Hi Ravi, thanks a lot. This worked perfectly.

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: JS for related record filtering in BPF - Dynamics 365 online

    Hi Brinda,

    Can you pass the oppid variable like this '"+oppid+"' in the fetch and test
    <condition attribute='opporunityid' operator='eq' value='" + oppid + "'>

    You might also need to remove the braces "{", "}", for this use can use java script replace method. something like this-

    var finalid = oppid.replace("{","").replace("}","");

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: JS for related record filtering in BPF - Dynamics 365 online

    Also, pls note that the code works perfectly fine if instead of $(oppId), I pass the actuall GUID of opportunity record that is opened. It would be really helpful if someone can help me on how to pass the record id in fetch. Thanks

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans