How to make employee contri and employer contri non-editable from dropdown with a table (Receipt)

Hi Team,
I am trying to make employee contribution and employer contribution non- editable base on my selection from the dropdown table called Receipt.
The selection includes as follow: EE&ER CONT, MGT/ER-CON, PENS-ENHAN, STAFF/EMP and UPFRONT. When I select EE&ER CONT and UPFRONT, employee and employer contribution editable should be true. If I select MGT/ER-CON and PENS-ENHAN only employer contribution should be editable why if I select STAFF/EMP only employee contribution should be editable. And I tried the option datatype for this approach, it did'nt work because it was calling another table, Receipt.
Thanks.

Answers

  • Nav_ilNav_il Member Posts: 30
    Which module are you working on? Did you develop this procedure or customided? Which version of Navision?
  • Olarewaju2345Olarewaju2345 Member Posts: 25
    I develop the customization, NAV 2018
  • KishormKishorm Member Posts: 921
    You will need to create a Boolean field, set the IncludeInDataset property and set it on the OnAfterValidate of the field with the lookup to the Recipt table and then finally set that Boolean on the Editable or Enabled property of the employer contri and employee contri fields.

    Have a look at how this is done in standard NAV on the Item Card, Planning fasttab.
  • bharathnanbharathnan Member Posts: 92
    jc7fp8hd4qkt.png

    Please check this out.
    Verify it if found helpful.
    Regards,
    Bharath K
  • Olarewaju2345Olarewaju2345 Member Posts: 25
    Hi Kishorm,

    I have already created the boolean and I also set IncludeInDataset property to YES. I wrote these in the OnAfterValidate of the field with the lookup to the Recipt table
    IF ("Type of Receipt" = "Type of Receipt"::Contribution) AND (TypeofReceipt."No." = 'STAFF/EMP') THEN BEGIN
    EmployeeContEnable := TRUE;
    EmployerContEnable := FALSE;
    END ELSE
    IF ("Type of Receipt" = "Type of Receipt"::Contribution) AND (TypeofReceipt."No." = 'MGT/ER-CON') THEN BEGIN
    EmployeeContEnable := FALSE;
    EmployerContEnable := TRUE;
    END;

    It's not working and what else can i do. Thanks
  • Olarewaju2345Olarewaju2345 Member Posts: 25
    Hi bharathnan<

    I tried your approach but it was not working because the dropdown is not an option datatype but table relation.
    Thanks
  • KishormKishorm Member Posts: 921
    You’ve missed the last bit about setting those Boolean fields on the Editable or Enabled properties of the fields of the page.

    You would also want to call that code on the OnAfterGetCurrentRecord trigger
  • Olarewaju2345Olarewaju2345 Member Posts: 25
    Kishorm, I have done that.
    OnAfterGetCurrRecord()
    IF ("Type of Receipt" = "Type of Receipt"::Contribution) AND (TypeofReceipt."No." = 'STAFF/EMP') THEN BEGIN
    EmployeeContEnable := TRUE;
    EmployerContEnable := FALSE;
    END ELSE
    IF ("Type of Receipt" = "Type of Receipt"::Contribution) AND (TypeofReceipt."No." = 'MGT/ER-CON') THEN BEGIN
    EmployeeContEnable := FALSE;
    EmployerContEnable := TRUE;
    END;

    It is not working, am using NAV2018
  • Olarewaju2345Olarewaju2345 Member Posts: 25
    Hi Kishorm,
    It is working now, I have to choose the Staff/emp and close the page after reopen the page before it reflected.
    "Receipt type code" is the field where the dropdown values save into.
    IF ("Type of Receipt" = "Type of Receipt"::Contribution) AND ("Receipt type code"= 'STAFF/EMP') THEN BEGIN
    EmployeeContEnable := TRUE;
    EmployerContEnable := FALSE;
    END ELSE
    IF ("Type of Receipt" = "Type of Receipt"::Contribution) AND ("Receipt type code"= 'MGT/ER-CON') THEN BEGIN
    EmployeeContEnable := FALSE;
    EmployerContEnable := TRUE;
    END;

    Thanks
  • krikikriki Member, Moderator Posts: 9,094
    [Topic moved from 'NAV/Navision Classic Client' forum to 'NAV Three Tier' forum]

    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.