Skip to main content

Notifications

PowerApps- Show or Hide TIME component from Date Time in Model Driven Apps

Implementation Steps:

 

Some time Use want to Show/Hide Time Field Component based on their Requirement

 

rampprakash_0-1635767054619.png

 

To Achieve that we need to write some JavaScript to enable and disabled Component

 

Syntax:

 

 

 

formContext.getControl(arg).setShowTime(bool);

 

 

 

arg = Field Logical Name

bool = true/false 

 

To Enable time Component:

 

 

 

function enableTimeComponent(executionContext){
var formContext = executionContext.getFormContext();
formContext.getControl("FieldLogicalName").setShowTime(true);
}

 

 

 

To Disable time Component:

 

 

 

function enableTimeComponent(executionContext){
var formContext = executionContext.getFormContext();
formContext.getControl("FieldLogicalName").setShowTime(false);
}

 

 

 

That's it 🙂

Comments

*This post is locked for comments

  • Ram Prakash Profile Picture Ram Prakash 5,055
    Posted at
    PowerApps- Show or Hide TIME component from Date Time in Model Driven Apps

    Hello @DanielAmico,

     

    Please find my link for JS (Onload/Onsave/OnChange) Event, and hope this helps. Let me know if you need any help:

     

    https://www.youtube.com/watch?v=x8kYNCkikgs&t=14s

     

     

  • DanielAmico Profile Picture DanielAmico 12
    Posted at
    PowerApps- Show or Hide TIME component from Date Time in Model Driven Apps

    Hi @rampprakash , Where do I have to put/save this script for it to work?

    Thanks