(Day 2) ServiceNow Scenario-Based Interview Questions | Close Parent Incident upon Child Closure"

Поділитися
Вставка
  • Опубліковано 15 жов 2024

КОМЕНТАРІ • 45

  • @Amba.traders89
    @Amba.traders89 5 місяців тому +2

    nice explanation

  • @sivavani1188
    @sivavani1188 2 місяці тому

    Thanks ravi for making such kind of videos. Its will be very helpful. Looking forward for more videos...

  • @shaiksameerbasha1361
    @shaiksameerbasha1361 4 місяці тому

    Thanks ravi for making thesekind of usecases. Looking forward for more vedios. 😊

  • @alokkashyap3970
    @alokkashyap3970 4 місяці тому

    Best video. We need more

  • @PhysicsCoshi
    @PhysicsCoshi Місяць тому

    Hi Ravi, will it work the same if we have an incident task instead of a child incident?

  • @gurusalivahan3262
    @gurusalivahan3262 5 місяців тому

    Hi Ravi ,
    Thanks for sharing the interview questions
    One update in the script
    In else condition please update the error message syntax
    Three times message is added ,due to this else condition is not working and it shows as invalid update.
    Thank you

    • @gurusalivahan3262
      @gurusalivahan3262 5 місяців тому

      Add info message as well

    • @learnservicenowwithravi
      @learnservicenowwithravi  5 місяців тому

      Share your script

    • @gurusalivahan3262
      @gurusalivahan3262 5 місяців тому

      @@learnservicenowwithravi
      Hi Ravi , below is the script.
      When before update record
      Cond:
      State changes
      (function executeRule(current, previous /*null when async*/) {
      var inc = new GlideRecord('incident');
      inc.addQuery('parent_incident', current.sys_id);
      inc.query();
      if (inc.next()) {
      if (inc.state == '7') {
      gs.addInfoMessage("This is child incident and the state is close ");
      current.setAbortAction(false); // misson successfull
      } else {
      gs.addErrorMessage("Child Incident is not closed,please close the child incident before closing he parent ");
      current.setAbortAction(true);
      }
      }
      })(current, previous);

  • @angelhues_bysmita3560
    @angelhues_bysmita3560 4 місяці тому

    If we have multiple child incidents in open state under that parent incident, then we need to first close all these child incidents to close the parent incident right? So how close the child incidents?

    • @learnservicenowwithravi
      @learnservicenowwithravi  4 місяці тому

      Check out all child linked to single parent and then close all child and then close parent

  • @makqdr6824
    @makqdr6824 4 місяці тому

    Hi Ravi, a quick question. Why do we need IF ELSE? can't we just write if (grinc.state != '7') current.setAbortAction(true);? Also in case of more than one children, can we get the count of child records where the ('parent_incident', current.sys_id) and child (grinc.state != '7') instead of looping? If yes, appreciate if you can share the logic. Thank you

  • @gganga6633
    @gganga6633 3 місяці тому

    Hi Ravi,
    i have written the same code, however i am unable to close the child incident as well. Am i making any error in the code?
    (function executeRule(current, previous /*null when async*/) {
    var Inc=new GlideRecord('incident');
    Inc.addQuery('parent_incident',current.sys_id);
    Inc.query();
    if(Inc.next){
    if(Inc.state=='7'){
    gs.addInfoMessage("the child incident is closed");
    current.setAbortAction(false);
    }
    else{
    gs.addErrorMessage("the child incident is not closed");
    current.setAbortAction(true);
    }
    }
    })(current, previous);

    • @learnservicenowwithravi
      @learnservicenowwithravi  2 місяці тому

      Let me check

    • @baatyr_patta1068
      @baatyr_patta1068 29 днів тому

      I found two bugs: 1) you need to add parentheses ( ) next to next method. It should be like this: if(Inc.next())
      2) your 'Inc' variable is written with CAPITAL 'I' which is not allowed for variable name. Change it to 'inc'.

  • @PavanKalyan-qc2ln
    @PavanKalyan-qc2ln 27 днів тому

    I have received similar requirement but when I used the business rule after abort action it was not staying on the same page.
    Again I have used ui action and it's fine. Could you please let me know what could be the reason

  • @kartik_official_5277
    @kartik_official_5277 5 місяців тому

    Hello sir , 5 may of my CSA exam so, you would like to provide me important questions for crack my CSA exam . because your explanation is very good 👍👍
    i like that.please sir provide me important questions for CSA (service now) Exam🙏🙏

    • @learnservicenowwithravi
      @learnservicenowwithravi  5 місяців тому

      drive.google.com/file/d/1P2c5vc1zJvi1vzllEJFLcnl3ySsGw6RP/view?usp=drivesdk

    • @kartik_official_5277
      @kartik_official_5277 5 місяців тому

      ​@@learnservicenowwithravi Sir that is enough of a question for cracking the CSA exam.??

  • @luciferpinny2676
    @luciferpinny2676 5 місяців тому +1

    Hi Ravi, i didn't get the script clearly.... because, you have written business rules in incident table, then why are you glide recording incident table again??? And also inc.state ==7 , this means, which state it is taking in incident table like, parent incident state or child incident state.....if it is taking child incident state, then how to we know it is taking child incident state

    • @learnservicenowwithravi
      @learnservicenowwithravi  5 місяців тому +1

      I glide because i have to check if parent incident has a child..i glide only once because i need to get parent_incident field..

  • @epapra795
    @epapra795 5 місяців тому +3

    explaination is good, but one video for one scenario may take time. Please include three or four in one video

  • @rahulnimsatkar429
    @rahulnimsatkar429 5 місяців тому

    Sir can you tell me how I convert knowledge article in service into the json body

  • @priteshfarate9716
    @priteshfarate9716 2 місяці тому +1

    Plz, check this one script... It will meet all conditions for the above requirement.
    Please let me know if I'm wrong...!
    It will also work on multiple child incidents. Should all the child incident state "Closed", then n only then this script will allow to change the parent incident state to "Closed". Otherwise not.
    BR: Before, Operation: Updates,
    Filter Condition: State changes to close.
    Script:
    (function executeRule(current, previous /*null when async*/ ) {
    var gr = new GlideRecord('incident');
    gr.addQuery('parent_incident', current.sys_id);
    gr.query();
    while (gr.next()) {
    if (gr.state != '7') {
    gs.addErrorMessage('Plz Close the all child incident n then u can change the state');
    current.setAbortAction(true);
    action.setRedirectURL(current);
    }
    }
    })(current, previous);

  • @PayalTripathy08
    @PayalTripathy08 5 місяців тому

    can you please share your google drive link?

  • @luciferpinny2676
    @luciferpinny2676 5 місяців тому

    And also, this example is for one child incident......if one incident have multiple child incidents then how we can write script ravi? I mean, how we can write query condition

  • @2PaweL
    @2PaweL 5 місяців тому +1

    +1

  • @priteshfarate9716
    @priteshfarate9716 2 місяці тому

    Plz check this one script... It will meet all conditions of the above requirements.
    correct me if I'm wrong... !
    BR: Before, Operation: Updates,
    Filter Condition: State changes to close.
    Script:
    (function executeRule(current, previous /*null when async*/ ) {
    var gr = new GlideRecord('incident');
    gr.addQuery('parent_incident', current.sys_id);
    gr.query();
    while (gr.next()) {
    if (gr.state != '7') {
    gs.addErrorMessage('Plz Close the all child incident n then u can change the state');
    current.setAbortAction(true);
    action.setRedirectURL(current);
    }
    }
    })(current, previous);

  • @astalkies9072
    @astalkies9072 5 місяців тому

    not sure why but else condition doesn't work
    var grinc = new GlideRecord('incident');
    grinc.addQuery('parent_incident', current.sys_id);
    grinc.query();
    if (grinc.next()) {
    if (grinc.state == '7')
    gs.addInfoMessage("child is in closed state");
    current.setAbortAction(false);
    } else {
    gs.addErrorMessage("child is NOT in closed state");
    current.setAbortAction(true);
    }
    Could you please validate

    • @yashwanthyash1464
      @yashwanthyash1464 4 місяці тому

      var grinc = new GlideRecord('incident');
      grinc.addQuery('parent_incident', current.sys_id);
      grinc.query();
      if (grinc.next()) {
      if (grinc.state == '7'){
      gs.addInfoMessage("child is in closed state");
      current.setAbortAction(false);
      } else {
      gs.addErrorMessage("child is NOT in closed state");
      current.setAbortAction(true);
      }
      }
      try this, you've missed to add braces after second if and closing of else.

  • @luciferpinny2676
    @luciferpinny2676 5 місяців тому

    Please help me ravi regarding this