Skip to main content

Notifications

Community site session details

Community site session details

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

how to change the value of custgroup and get subgroupid in salestable form ax 2012

(0) ShareShare
ReportReport
Posted on by 5

pastedimage1604049439643v1.png

 hi,

I add two fields in sales table  custgroup, subgroupid. from--- i change the value of customer group field select 10 custgroup than subgroupid is not selected same cutomergroup.

  • Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: how to change the value of custgroup and get subgroupid in salestable form ax 2012

    Hi satendra singh,

    The code looks correct. One thing I can't see in the screenshot is if you have a break statement after the case statement for field "CustGroupId".

    Here you are setting the Sub-group Id to the value set for the same field in the customers form. If this code is still not setting the value for you, did you try to debug this method and check if the correct values are being fetched in this method?

  • satendra singh ax Profile Picture
    5 on at
    RE: how to change the value of custgroup and get subgroupid in salestable form ax 2012

    Hi Gunjan,

    I am writing the code in SalesTable /Methods /ModifiedField. Still I am facing this issue.

    pastedimage1604225003653v1.png

  • Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: how to change the value of custgroup and get subgroupid in salestable form ax 2012

    Hi satendra singh,

    Were you able to get this working? Or are you still facing any issues?

  • satendra singh ax Profile Picture
    5 on at
    RE: how to change the value of custgroup and get subgroupid in salestable form ax 2012

    hi,

    Yes

  • Suggested answer
    nmaenpaa Profile Picture
    101,158 Moderator on at
    RE: how to change the value of custgroup and get subgroupid in salestable form ax 2012

    Ok, then just add your code in the modifiedField method of SalesTable.

    If modified field is CustGroupId, select first customer sub group that has the same customer group id, and put that in the sub group field. Is it clear?

  • satendra singh ax Profile Picture
    5 on at
    RE: how to change the value of custgroup and get subgroupid in salestable form ax 2012

    hi,

    Do you want to automatically set subgroup, based on the selected customer group?

    yes.

  • satendra singh ax Profile Picture
    5 on at
    RE: how to change the value of custgroup and get subgroupid in salestable form ax 2012

    Hi Gunjan,

    Sub Group Id is Customized field. whenever i changed  the  customer group that time sub groupid  default first value select .

    pastedimage1604051673279v2.png

    pastedimage1604051617600v1.png

  • Suggested answer
    nmaenpaa Profile Picture
    101,158 Moderator on at
    RE: how to change the value of custgroup and get subgroupid in salestable form ax 2012

    I'm sorry but I don't understand.

    Do you want to automatically set subgroup, based on the selected customer group?

    Or do you want to only show subgroups related to specific customer group in the lookup?

    If you just want to impact the lookup, make sure that you have properly defined table relations between your SalesTable fields and Customer sub group table. The relation should include customer group id and customer sub group id. Then the user can only select such subgroups that are related to the already selected customer group.

  • satendra singh ax Profile Picture
    5 on at
    RE: how to change the value of custgroup and get subgroupid in salestable form ax 2012

    Hi,

    i modify the custgroup like that i selected coustmergroup 10 than sub groupid  field  default select first value .

    pastedimage1604050917728v1.png

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: how to change the value of custgroup and get subgroupid in salestable form ax 2012

    Hi satendra singh,

    Is Sub group Id a customized field? You will need to write your code in Tables\SalesTable\modifiedField method to assign the new sub group Id whenever the customer group is changed.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March 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... 294,120 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans