cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate II
Advocate II

Default values for "input" properties

Hi,

 

  is there a way to pass default values to the control properties? Those that have usage set to "input" ?

 

Thanks,

Alex

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted

Personally I would just add the default values to the parameters at the top of the index.ts class and then override them with the parameter value at the top of the updateView method.

 

private template: string="Default Value";

public async updateView(context: ComponentFramework.Context<IInputs>): Promise<any>
	{		
		this.contextObj = context;
		if (context.parameters.Template){		
			this.template=context.parameters.Template;
		}		

 

 

---
If this post has answered your question please consider it for "Accept as Solution" or if it has been helpful give it a "Thumbs Up".

View solution in original post

Highlighted

Hi Alex, there is already a property to define a default value, it is default-value

my control already uses it (source) and the form designer show the values (however they are not rendered in the harness)

 

in my blog post there is a screenshot of the properties

View solution in original post

8 REPLIES 8
Highlighted
Advocate V
Advocate V

Yes, there is usually a "Default" property on each control. Depeinging on the type you can set it to a date, a true/false value or text.

 

Set it to something static or use a variable.

Highlighted

Hi Magnus,

 

  I am looking for a way to add default property value to the control manifest in PCF. Something like this:

 

<property name="test" display-name-key="test" description-key="test" of-type="SingleLine.Text" usage="input" required="false" default="default value" />

 

  The above line does not work, though, since "default" attribute is not recognized.

 

 

Highlighted

Personally I would just add the default values to the parameters at the top of the index.ts class and then override them with the parameter value at the top of the updateView method.

 

private template: string="Default Value";

public async updateView(context: ComponentFramework.Context<IInputs>): Promise<any>
	{		
		this.contextObj = context;
		if (context.parameters.Template){		
			this.template=context.parameters.Template;
		}		

 

 

---
If this post has answered your question please consider it for "Accept as Solution" or if it has been helpful give it a "Thumbs Up".

View solution in original post

Highlighted

Hi Ben,

That would work, but I was hoping to actually to be able to show those default values in the form designer(can probably add them to the description, too, when they are not too long... but would be nice if the users could see those default values, not just assume them from the "documentation")
Highlighted


@ashlega wrote:
Hi Ben,

That would work, but I was hoping to actually to be able to show those default values in the form designer(can probably add them to the description, too, when they are not too long... but would be nice if the users could see those default values, not just assume them from the "documentation")

This is great suggestion @ashlega , can you please log a feature request idea here ?

 

hemant 

Highlighted

Hi Hemant,

 

  there you go: https://powerusers.microsoft.com/t5/PowerApps-Ideas/Support-default-parameters-for-PCF-control-prope...

 

  It seems Ben's suggestion would be the answer for now.

 

Thanks,

Alex

Highlighted

Hi Alex, there is already a property to define a default value, it is default-value

my control already uses it (source) and the form designer show the values (however they are not rendered in the harness)

 

in my blog post there is a screenshot of the properties

View solution in original post

Highlighted

Thanks, Guido! I think that's exactly what I was looking for.

 

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Users online (5,887)