0

Primary Name field is by default "Required". How to fill this field by GUID or random number on save?

Benny7500
  • 569
  • 6
  • 16

2 Answers2

1

Codeless solution: You can mark that field as not a Business Required, so you will be unblocked. You can use a codeless UI workflow to populate the Primary Name field with some fixed text. This WF can be triggered on post-create.

Code solution: Plugin can be triggered on pre-create & custom C# code can be used to pre-populate some autonumber/text in this field.

Pro tip: Model driven app is nothing but classic Dynamics CRM, so while searching for solutions use that keyword :)

0

There is a GUID() function in PowerApps that generates a random GUID. By default, its result is a GUID type of data (text, value, date, etc.).

Primary Name is a text field. To coerce the result of the GUID function to be a text string, wrap Text() around it:

Text(GUID())

So in your Patch statement or in the Update property of the field for PrimaryName, you can use the expression above to put in a GUID as a string.

mr-dang
  • 21
  • 1
  • Yes, this solution is available in Canvas apps, but in Model driven apps there's no GUID() function. If I'm correct... – Benny7500 Oct 24 '18 at 19:43