Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Need help with an if statement

Avatar

Former Community Member

I am very new at writing Javascript and am having a lot of fun learning.  I need some help with one that has me out in left field.

I have a negative (or a positive) value in a cell.  Generally, the value is going to be negative with only a few exceptions in the other direction.  What I want to do is make two different electronic signatures appear from their current invisible status, BUT only with different values in the calculated cell.

Right now I have the following script...

if (this.rawValue < "1") {

     AcctEsig.presence = "visible";

     } else {

     AcctEsig.presence = "invisible";

}

I need this one to  make the AcctEsig object appear actually when the value is between -1 and -99

I will need the next one to open the account manager's Esignature if the value is -100 or even less.  Therefore as one can see, I'm thinking I can get away with 2 separate scripts, BUT I know that there may be one that can present both eSig blocks but at the designated different times.

Any ideals?

Thank you so much ahead of time.

1 Accepted Solution

Avatar

Correct answer by
Level 7

you should put it in the exit event and make sure your form is saved as a dynamic form not a static form. Then it should work.

View solution in original post

4 Replies

Avatar

Level 7

try this:

if (this.rawValue <= -1 && this.rawValue >= -99) {

AcctEsig.presence = "visible";

}

else if (this.rawValue <= -100) {

AcctEsig2.presence = "visible";

}

Avatar

Former Community Member

Good morning and thank you for your suggestion.  I tried it and it did not work.  I do have it under a "change" event, which I believe is right, but if not I can obviously change that.  From an amatuer standpoint, your code looks great, so I am not sure what may be wrong.  Any other suggestions?  Again, I am super appreciative of your assistance!

Mike

Avatar

Correct answer by
Level 7

you should put it in the exit event and make sure your form is saved as a dynamic form not a static form. Then it should work.

Avatar

Former Community Member

Perfect.  Thank you so much for your help with this!

I may look you up again!!