cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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

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

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
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.

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.

 

 

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

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")


@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 

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

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

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

 

 

Helpful resources

Announcements
News & Announcements

Community Blog

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

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Users online (7,542)