You need to sign in to do that
Don't have an account?
raj jordan
All fields in a Custom metdata type should be required
hi all,
i want to create a custom metadata object then i want to add fields to it
the fields which are added to that object should become required
can you please help me
i want to create a custom metadata object then i want to add fields to it
the fields which are added to that object should become required
can you please help me
Sorry it took me some time to respond.
Please try the following code:
All Answers
The field of Custom Metadata object can be set to required during the field creation (as it is possible when creating a custom field for any object).
Please let me know if you want me to send you a step-by-step instructions on Custom Metadata creation.
can you help me through this
Unfortunately it is imposible to create a trigger for Custom Metadata object.
The only possible way to make fields required is to create those fields as required or use validation rules for those fields.
My requirement is i want to make some of the account fields mandatory by using custom metadata
Can we do this
if so can u help me
Can you please give me an example for such a case ? How is Custom Metadata used in this case ?
Thanks,
Dmitry
and the fields which i want to make required in account will be added as records in custom metadata
now i have to write a trigger on account such that whenever the account is inserted the those fields should be mandatory
I see. So, before saving an Account you want to check that if one of the field names written in Custom Metadata is empty on Account record - you want to return an error message and not to save the Account record ? Is that right ?
Thanks,
Dmitry
Just give me a few minutes and I will send you a sample trigger code for this.
Now you need to create a trigger on Account object that looks like that: That should do the validation.
Please let me know if you have any questions.
Thanks,
Dmitry
but while updating it is not showing error
If you want it to work for update validations just remove the IF statement and it will work for both update and insert.
Your final version of trigger should look like this:
Regards,
Dmitry
thank for ur time.
I'm happy it helped.
how can i display all errors at a time ?
the above code is just displaying one error at a time
can you please look at this
Thanks in Advance
Sorry it took me some time to respond.
Please try the following code: