28 Jul 2020
Link to this post
after record is created, on portal form i have 3 fields which are hidden and they are visible only when request is received from D365 CRM. which is working fine and below is the code for it.
now problem is, i have Subject option set field on form with 3 options enhancement, support and implementation. when record is creating i will select enhancement in subject form will be saved. after saving record if change subject to support or implementation and again back to enhancement hidden fields are showing on the form.
please suggest how i can add my logic in below code.
$(document).ready(function() {
$('#new_activestage').hide();
$('#new_activestage_label').hide();
var activeStage=$("#new_activestage").val();
var reqApproval=$("#new_requirementapproval").val();
var estApproval=$("#new_estimationapproval").val();
var uatApproval=$("#new_uatapproval").val();
//Verifing for Estimation Approval
if(activeStage.includes("Estimation Approval") || estApproval==1 || estApproval==2)
{
$('#new_estimationapproval').show();
$('#new_estimationapproval_label').show();
}
else
{
$('#new_estimationapproval').hide();
$('#new_estimationapproval_label').hide();
}
//Verifing for UAT Approval
if(activeStage.includes("UAT Approval") || uatApproval==1 || uatApproval==2)
{
$('#new_uatapproval').show();
$('#new_uatapproval_label').show();
}
else
{
$('#new_uatapproval').hide();
$('#new_uatapproval_label').hide();
}
//Verifing for Requirement Approval
if(activeStage.includes("Requirement Approval") || reqApproval==1 || reqApproval==2)
{
$('#new_requirementapproval').show();
$('#new_requirementapproval_label').show();
}
else
{
$('#new_requirementapproval').hide();
$('#new_requirementapproval_label').hide();
}
$('#subjectid').on('change', function() {
if ($('#subjectid').val() == "9d2581b4-41a0-e911-a994-000d3af29e21")
{
$('#new_requirementapproval').show();
$('#new_requirementapproval_label').show();
$('#new_estimationapproval').show();
$('#new_estimationapproval_label').show();
$('#new_uatapproval').show();
$('#new_uatapproval_label').show();
}
else
{
$('#new_requirementapproval').hide();
$('#new_requirementapproval_label').hide();
$('#new_estimationapproval').hide();
$('#new_estimationapproval_label').hide();
$('#new_uatapproval').hide();
$('#new_uatapproval_label').hide();
}
})});