Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Workflow form redirect shows all records.

(0) ShareShare
ReportReport
Posted on by 64

Hi all,

I have created a custom workflow and it works perfectly .

The problem is that the approval manager when checks the "work items assigned to me " form , I tiwll show a record saying "abc submitted".

On click of this it actually opens the workflow list form which again has a hyperlink form to the main table but the problem is that when the main form is opened it shows all the records to the approval manager . I am not sure if we need to write some logic on init for this too as I was assuming that this works by std.

Am I missing any setting.

Below requirement when form is opened normally.

Also the custom form on which workflow is set needs to show records to users based on their userid only  So user a will see 10 records submitted by him only and not of other users.

However the manager will see all the records whenever this form is open via normal ways.

Thanks,

VK

  • vicky1234 Profile Picture
    64 on at
    RE: Workflow form redirect shows all records.

    Thanks Komi and Girish

    the above code works .

    For the user filteration  ssue I wrote another logic to fix it.

  • Suggested answer
    GirishS Profile Picture
    27,823 Moderator on at
    RE: Workflow form redirect shows all records.

    Hi vicky,

    As per komi comment you need to add caller as query range to details form.

    Also you mentioned another requirement - Show data based on the user ID. For this you need to enable created by property to yes on the table level.

    On the execute query you need to check whether logged in user ID is not manager means - add the range to created by field and value should be curuserid() and on the else statement clear range.

    Thanks,

    Girish S.

  • Verified answer
    Komi Siabi Profile Picture
    12,789 Most Valuable Professional on at
    RE: Workflow form redirect shows all records.

    Hello Vicky,

    You need to have two form a detail page and a list page. On the detail page, you need to write a line of code on the form init, and on the datasource execute query.

    RecId record;
    
    /// 
    /// Form init
    /// 
    public void init()
    {
        YourTable yourTable = element.args().record();
        record = yourTable.RecId;
        super();
    }

    Datasource

    /// 
    /// Datasource 
    /// 
    public void executeQuery()
    {
        QueryBuildRange         qr;
        
        qr = this.Query().dataSourceTable(tableNum("yourTable")).addRange(fieldNum(yourTable,recid));
        qr.value(SysQuery::value(record));
        qr.status(RangeStatus::Locked);
        super();
    }

  • Suggested answer
    Dynamics Community 101 Profile Picture
    310 on at
    RE: Workflow form redirect shows all records.

    Hi Vicky,

    Please ensure that menu items assigned in workflow approval and workflow type are of detail page form and not list page forms.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,274 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,947 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans