Hi,
is there a way to pass default values to the control properties? Those that have usage set to "input" ?
Thanks,
Alex
Solved! Go to Solution.
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; }
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; }
@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
Thanks, Guido! I think that's exactly what I was looking for.
User | Count |
---|---|
4 | |
3 | |
1 | |
1 | |
1 |
User | Count |
---|---|
6 | |
5 | |
4 | |
3 | |
1 |