Skip to main content



No record found.

Microsoft Dynamics SL forum

How to pass current CPNYID to PV parameter

Posted on by Microsoft Employee

I want to customize an user field to CPNYID field in Salesperson table and put a PV field in sale order screen. I want when hit F3 it just display salespersons that have the same company ID. I don't know how to pass current CPNYID to PV parameter. Help me please

 Thanks in advance

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to pass current CPNYID to PV parameter

    Thanks you all

    I do as Perumalsamy's suggestion and it's work !

  • Verified answer
    Ram Peru Profile Picture
    Ram Peru 2,830 on at
    RE: How to pass current CPNYID to PV parameter

    Hello Nam,

    To my knowledge, you cannot change the Standard PV that is already associated with Sale Person Id in Sales Order Entry Screen. Sales Person is common based on the Sales Territory for all the companies available in Dynamics SL.

    You can have the work around to achieve this functionality. You need to customize the Sales Order Entry screen. If you want to include the company Id in Sales Person screen, you need to customize the Sales Person Screen and use one of the available user fields from Sales Person table.

    1. You need to customize the Sales Person screen and include the company Id into screen.

    2. Create the new PVRec stored procedure and include the company id and Sales Person as parameter. Use the below standard procedure as reference.

    a. ADG_Salesperson_All – This standard PV is available in Sales Order Line Item. This procedure has salesperson as parameter.

    3. Create the New PVRec file based on the standard PVRec file available in “…\SL\Applications\DB\csvs”

    4. Import the PVRec file using possible values Import screen.

    5. Set the visible property as False for the standard Sales Person Id(cslsperid_1) control

    6. Include the new SAFTextBox control and place the control above the cslsperid_1 control and use the user field that is available for usage from Sales Order Line (SO Line)

    7. Include the newly created by in the PV property of the newly added control. Use the below as reference.

    a. “xxxxxxx”, "bpes.cpnyid"; 0; 0; 0; 0,

    8. Please ensure the standard sales person id field has the value while selecting the PV from the custom field.

    Hope this explains.


    Perumalsamy R

  • RE: How to pass current CPNYID to PV parameter


    You can get the current company id from SOHeader table. Just create a PV and pass the parameter as bSOHeader.CpnyID. 



Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .


André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,696 Super User

Martin Dráb Profile Picture

Martin Dráb 225,490 Super User

nmaenpaa Profile Picture

nmaenpaa 101,148


Featured topics

Product updates

Dynamics 365 release plans