Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Set default values in 'Material' entity

(0) ShareShare
ReportReport
Posted on by 550

Hi.

I have a CRM 4.0 implementation already migrated to CRM 2011. We have a tool loading 'Materials' from an external database, and this is working fine.

I'm now working on refining codes for CRM 2013 migration, and I found some problems...

If I try to add a new material manually, I get a message 'You must provide a value for Default Unit'. It seems that the script does not work properly for manually created materials! (the data load works fine).

If I try to populate the field manually, by selecting from list, I get the error in th efirst screenshot. I click OK and then I can select the value from the list. For the second field it works wiothout error - but I have to manually select it.

In both cases we only have 1 value available

Could you please suggest me a proper code to have these 2 fields always populated with the default values?

Many thanks...

--------------------------------------------------

Existing code is:

function Form_onload()
{

if( crmForm.FormType == 1)
{
          document.all.defaultuomscheduleid_ledit.focus();
          document.all.defaultuomscheduleid_ledit.value = 'Default Unit';
}

}
function defaultuomscheduleid_onchange()
{
if( crmForm.FormType == 1)
{
     document.all.defaultuomid_ledit.focus();
     document.all.defaultuomid_ledit.value = 'Primary Unit';
}
}

*This post is locked for comments

  • Claudio Casonato Profile Picture
    550 on at
    RE: Set default values in 'Material' entity

    BTW... the 'Custom Code validation tool' (version 2.0.0.1) did not indicate this code as not compatible... so I was sure this one was OK, until I tested in 'real' world...

  • Claudio Casonato Profile Picture
    550 on at
    RE: Set default values in 'Material' entity

    Thank you sooo much!

    It worked like magic!

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Featured topics

Product updates

Dynamics 365 release plans