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
Impactful Individual
Impactful Individual

Re: Default values for "input" properties

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
Advocate I
Advocate I

Re: Default values for "input" properties

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

Re: Default values for "input" properties

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.

Advocate II
Advocate II

Re: Default values for "input" properties

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
Impactful Individual
Impactful Individual

Re: Default values for "input" properties

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
Advocate II
Advocate II

Re: Default values for "input" properties

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
Power Apps
Power Apps

Re: Default values for "input" properties


@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
Advocate II
Advocate II

Re: Default values for "input" properties

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
Advocate I
Advocate I

Re: Default values for "input" properties

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
Advocate II
Advocate II

Re: Default values for "input" properties

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

 

 

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Users online (9,273)