Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

How to hide a field if you are creating a new Case but if editing a case it is visible?

Posted on by Microsoft Employee

Hi 

I want my field to be hidden  when creating a record but if editing the record I want the field to be visible. How do I do this?

Please help.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to hide a field if you are creating a new Case but if editing a case it is visible?

    This one did it for me. Thank you

  • Suggested answer
    Pradeep Rai Profile Picture
    Pradeep Rai 5,490 Super User 2024 Season 2 on at
    RE: How to hide a field if you are creating a new Case but if editing a case it is visible?

    Hi,

    As everyone said,

    You can use Business Rule to Show/hide the field as shown below:
    pastedimage1630567662809v1.png

    CreatedOn does not contains data refer to "Create" mode.

    Another way is to use the JAVSCRIPT as shown below:


    function showHideField() {
    var formContext=executionContext.getFormContext();

    if(formContext.ui.getFormType() == 1) {
    formContext.getControl('fieldname').setVisible(false);
    }
    else {
    formContext.getControl('fieldname').setVisible(true);
    }
    }

    Thanks,
    Pradeep.

    Please mark this as VERIFIED if it helps

  • Suggested answer
    Nya Profile Picture
    Nya 29,056 on at
    RE: How to hide a field if you are creating a new Case but if editing a case it is visible?

    Hi,

    Here is an example field called "Invisible when creating" and you can create a business rule for it.

    pastedimage1630566464205v1.png

    As the Case Title is a required field, it can be set as a condition to determine if the custom field is shown or not.

    The business rule can be something like:

    pastedimage1630567318537v5.png

    Then save and activate the rule.

    After inserting the field into the form, when creating a record, it is shown as:

    pastedimage1630567215504v4.png

    When updating an existing record, it is shown as:

    pastedimage1630567424319v6.png

  • Suggested answer
    TNS Profile Picture
    TNS 1,195 on at
    RE: How to hide a field if you are creating a new Case but if editing a case it is visible?

    Hi cam64,

    You can do it by js, use getFormType it will give you the form type of record. for more reference see the below link:

    docs.microsoft.com/.../getformtype

  • Verified answer
    Ram Prakash Profile Picture
    Ram Prakash 2,285 on at
    RE: How to hide a field if you are creating a new Case but if editing a case it is visible?

    Hi ,

    Open Dataverse/CRM System --> click gear icon at the top --> then select Advance Settings --> then select customisation then Customize the system --> then Click Entries --> Expand Entities --> select the entity where you want to perform the operation --> then Expand and select Business Rules --> then click New

    Write Codition as 

    If Created on Contains Data

    Then

    Visible field

    Else

    Don't visible

    Plase make as answer if it's helpful.

    microsoftcrmtechie.blogspot.com

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans