Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Billability and Resource Category auto mapping

(0) ShareShare
ReportReport
Posted on by 212

Hello

I have a form named "ResourceReqTableList" in which I have two fields named Billability and Resource Category. Billability has 3 line properties namely billable, BT and non billable while Resource category is an enum having multiple values. My requirement is that  While selecting billable option in Billability, only ‘Project Allocated’ should be reflected under Resource category and if we select non billable option in Billability field, then â€˜Project Allocated’ option should not be reflected under the Resource category field.

Please help me achieve this.

Thanks and Regards

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Billability and Resource Category auto mapping

    I would try using add method first. If any issue then probably create two custom form controls for ResourceGroup enum and make one visible based on Billability value. On form datasource write, you can take value from custom control and map to datasource field. 

    anithasantosh.wordpress.com/.../

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Billability and Resource Category auto mapping

    I think it's better to go with string control. Create a table for storing Enum values. On the lookup method you can loop through Enum values based on the Billability selection and insert the values into the table you created. On the same lookup method use that table in the lookup query.

    This is my suggestion instead of going for addition and deletion of Enums at runtime which produces wrong output.

    Thanks,

    Girish S.

  • Dynamics365Admin Profile Picture
    Dynamics365Admin 212 on at
    RE: Billability and Resource Category auto mapping

    Hi Girish and Mohit

    I think doing this would add the ProjectAllocated enum value twice if billable is selected at first. Don't we need to check that while selecting billable first, project allocated enum value exists in the control or not?

    Also the code I had given above, If we first select nonbillable and then select billable, the resource category control would be left with no enum values to show as all values would have been deleted.

    Please help

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Billability and Resource Category auto mapping

    As Girish mentioned, Please use 'add' method to add the enum values. Also, test that the enum integer value is saving correctly in the table.

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Billability and Resource Category auto mapping

    Check whether there is any method named add.

    If yes you can add that enum in the else part to add ProjectAllocated enum.

    this.add(enum2str(EnumName::ElementName));

    Thanks

    Girish S.

  • Dynamics365Admin Profile Picture
    Dynamics365Admin 212 on at
    RE: Billability and Resource Category auto mapping

    Hi all

    Thanks for you help. The code is working fine now. Just one issue, when I select nonbillable, then project allocated is deleted from the resource category, that is fine, but then if I select Billable again (after choosing nonbillable, then choosing billable), then also I cannot see project allocated under resource category. Does it mean that once the enum value is deleted, then it cannot be retrieved even after selecting billable. Is there any way we can bring the deleted enum value after choosing a different option under the billable field.

    Thanks and Regards

     public void enter()
            {
                super();
               
                if( INCK_ResourceRequitionLine.Billability == "NonBill")
                {
                    this.delete(enum2str(INCI_ResourceCategory::ProjectAllocated));
                
                }
    
                else if(INCK_ResourceRequitionLine.Billability == "Billable")
                {
                    this.delete(enum2str(INCI_ResourceCategory::BGVInProgress));
                    this.delete(enum2str(INCI_ResourceCategory::Bench));
                    this.delete(enum2str(INCI_ResourceCategory::Buffer));
                    this.delete(enum2str(INCI_ResourceCategory::CampusHire));
                    this.delete(enum2str(INCI_ResourceCategory::CapabilityInvestment));
                    this.delete(enum2str(INCI_ResourceCategory::ContractualBuffer));
                    this.delete(enum2str(INCI_ResourceCategory::DeliveryManagement));
                    this.delete(enum2str(INCI_ResourceCategory::MLLOP));
                    this.delete(enum2str(INCI_ResourceCategory::ProjectSupport));
                    this.delete(enum2str(INCI_ResourceCategory::Sales));
                    this.delete(enum2str(INCI_ResourceCategory::Support));
                  
                }
            }

  • Dynamics365Admin Profile Picture
    Dynamics365Admin 212 on at
    RE: Billability and Resource Category auto mapping

    okay, will do that and let you know, thanks.

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Billability and Resource Category auto mapping

    I asked you to debug and find out whether debugger is hitting or not. Have you done that?

    Without debugging it's hard to find out the issue. So please debug and see what's going wrong.

    Thanks,

    Girish S.

  • Dynamics365Admin Profile Picture
    Dynamics365Admin 212 on at
    RE: Billability and Resource Category auto mapping

    Not getting any errors now, but still Project Allocated option is there under Resource Category field even after selecting NonBill in the Billability field.

    Seems the code is not working correctly.

    Screenshot-_2800_26_2900_.png_2D00_640x480.pngScreenshot-_2800_26_2900_.png_2D00_584x328.png

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Billability and Resource Category auto mapping

    Are you still getting the error or is it fixed after changing 'this' to formComboBoxControl.

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,187 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,966 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans