Skip to main content

Notifications

Microsoft Dynamics SL (Archived)

Add New Parameter To PV

Posted on by 555

For Receipts Screens in Inventory Module

The following users will be the only users allowed to use sites that do not begin with either “TRK” or “SVC”: 

User1

User2

First Have modified Sp and Pvrec.csv and try to send current User ID as a new  Parameter In CsiteId PV field but it shows "Set Property Returned an error .Check scode for value" error.

Actually i want to customize this screen only i don't want to Customize with same PV for other screen like Transfers.

so how can i do that?please help me

*This post is locked for comments

  • ThillaiRaja Profile Picture
    ThillaiRaja 555 on at
    RE: Add New Parameter To PV

    Mr.Rick Thanks for your response.

    I have create a new Pv in Intran.User1 field in Recipts Screen.

    Have altered Site_With_InvtFlag Procedure ,Have a custom Table X_site in X_Site Columns are UserID,SiteId and Enable .

    Intran.USer1 PV:"X_Site_With_InvtFlag", "bpes.cpnyid"; 0; 0; 0; 0, "bintran.invtid"; 0; 0; 0; 0, "bPes.UserId"; 0; 0; 0; 0,

    CustomPv.Csv: X_Site_With_InvtFlag,,,SELECT * FROM vi_SiteWithInvtFlag WHERE CpnyID = @Parm1 AND (InvtID = @Parm2 or (InvtID is null and not exists (select 'x' from vi_SiteWithInvtFlag v2 where vi_SiteWithInvtFlag.CpnyID = v2.CpnyID AND v2.InvtID = @Parm2 AND vi_SiteWithInvtFlag.SiteID = v2.SiteID ))) And siteid =(CASE WHEN @Parm3 not in (select Top 1 UserId from X_site x where x.UserId=@Parm3) then SiteId WHEN vi_SiteWithInvtFlag.User5=0 then SiteId when vi_SiteWithInvtFlag.User5=1 AND vi_SiteWithInvtFlag.SiteId is not null and (not exists (select 'x' from X_site x where vi_SiteWithInvtFlag.SiteId=x.SiteId and not (x.UserId = @Parm3 and enable =1 ))or exists(select 'x' from X_site x where vi_SiteWithInvtFlag.SiteId=x.SiteId and (x.UserId = @Parm3 and enable=1))) Then siteid end) AND vi_SiteWithInvtFlag.SiteId LIKE @Parm4 ORDER BY vi_SiteWithInvtFlag.SiteID,Site,vi_SiteWithInvtFlag.SiteID;Site ID;118;0,vi_SiteWithInvtFlag.Name;Name;110;0,vi_SiteWithInvtFlag.ExistingSiteFlag;Active Site for this Item;0;0

    if Site.User5=1 then it's restricted site and if the particular user have access in X_Site then only he can see the site.

    X_site Table Sample:

    UserId SiteId Enable

    SYSADMIN 200 1

    USerA 400 1

    Thillai 200 1

    ANBURAJ 200 1

    My StoreProcedure is

    In procedure have  passing CurrentUserID as @Param3

    Create PROCEDURE X_Site_With_InvtFlag

    @Parm1 VARCHAR (10),--'0060' CpnyID

    @Parm2 VARCHAR (30),--'0RBOLT' InvtID

    @Parm3 VARCHAR (30),--'SYSADMIN' --Here have changed Invt Id to USerID

    @Parm4 VARCHAR (10)--% --SiteID

    As

    SELECT distinct * FROM vi_SiteWithInvtFlag WHERE CpnyID = @Parm1 AND (InvtID = @Parm2 or (InvtID is null and not exists

    (select 'x' from vi_SiteWithInvtFlag v2 where vi_SiteWithInvtFlag.CpnyID = v2.CpnyID AND v2.InvtID = @Parm2 AND vi_SiteWithInvtFlag.SiteID

    = v2.SiteID ))) And siteid = ( CASE WHEN @Parm3 not in (select Top 1 UserId from X_site x where x.UserId=@Parm3) then SiteId WHEN

    vi_SiteWithInvtFlag.User5=0 then SiteId when vi_SiteWithInvtFlag.User5=1 AND vi_SiteWithInvtFlag.SiteId is not null and (not exists

    (select 'x' from X_site x where vi_SiteWithInvtFlag.SiteId=x.SiteId and not (x.UserId = @Parm3 and enable =1 ))or exists(select 'x' from X_site

    x where vi_SiteWithInvtFlag.SiteId=x.SiteId and (x.UserId = @Parm3 and enable=1))) Then siteid end) AND vi_SiteWithInvtFlag.SiteId

    LIKE @Parm4 ORDER BY vi_SiteWithInvtFlag.SiteID

    The above sp is Perfectly working in Sql .but in Screen i press f3 then error only showing .Have attached the First error screen shot and 2 nd error is The cursor (82) has 0 columns associated it should be greater then o and less then or equal to 256.

    Please any one help me.

    Here UserID as @Param3 but in Error screen showing X.userid='0060' so it collaspe the Params.but have removed the case statement in Store procedure then it will works fine.but very difficult to write without case statements.

    Here i can not insert image so i posted as new question .the link is  

    "community.dynamics.com/.../149147.aspx"

    what i did wrong?please can you help me?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Add New Parameter To PV

    Several SL PV statements use CASE statements and I have used them in custom PVRECs.  So, the answer is: yes, you can use a case statement.

  • ThillaiRaja Profile Picture
    ThillaiRaja 555 on at
    RE: Add New Parameter To PV

    Hi Perumalsamy ,

       In My New SP Have used Case statements but if i used case statements then in screnn i press f3 then error only showing.if i remove the case statements then working fine.but in my sp very tough to create a sp without case statements?is possible to use case statements in PV?

  • ThillaiRaja Profile Picture
    ThillaiRaja 555 on at
    RE: Add New Parameter To PV

    Mr.Perumalsamy

    my previous post also you gave the solution, now also you save me .. very thanks.

  • Verified answer
    Ram Peru Profile Picture
    Ram Peru 2,830 on at
    RE: Add New Parameter To PV

    Yes,  you don't have to add the same PV into new field. You have to do the followings

    1.You have to create a stored procedure that has to fulfil the above requirement

    2.You need to create new PVrec based on your requirement.

    3.Import the PVRec file into Dynamics SL Using Possible Values Import

    4.Add that PV procedure into the PV property of new field.

    Hope this explains.

  • ThillaiRaja Profile Picture
    ThillaiRaja 555 on at
    RE: Add New Parameter To PV

    Mr.Perumalsamy thanks for your quick response. i  am not correctly getting this line

    "add the new field with the same exact properties with the exception of the PV".it mean by don't add the PV properties to that new field? please can you explain bit more?

  • Suggested answer
    Ram Peru Profile Picture
    Ram Peru 2,830 on at
    RE: Add New Parameter To PV

    Hello ThillaiRaja,

    You cannot change the standard PV property in Customization Manager, but you are able to modify/add (to an extent) some of the fields that the stored procedure called by the PV displays.

    You can do the work around for this.

    You have to add a copy of an existing table structure (e.g. Intran) and aliased it with another name. You are able to go into the insert object wizard and add the aliased structure with the field you wanted

    You have to hide the original field and add the new field with the same exact properties with the exception of the PV.

    On the chk event of the new field, you have to setup the original field to the value of the new one. On form_display, you have to setup the value of the new field to the original so that it would properly display on the screen.

    Hope this explains.

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans