This topic contains 4 replies, has 0 voices, and was last updated by SererraMike 7 years, 3 months ago.

  • Author
    Posts
  • #9757 Score: 0

    SererraMike
    • Contributions: 0
    • Level 1

    I’m trying to set a field value in workflow. I’m working on a custom record. I have one field (Field A) that the user enters a decimal value in. After Edit of Field A, I’d like to populate another field (Field B) as Field A + 2000. I could swear I’ve done this hundreds of times before, but when I choose to populate with the formula {fielda} + 2000, I’m simply having 2000 appended onto the end of the value. So if Field A is 2000, instead of getting 4000, I’m getting 20002000. The formula works if I multiple, or subtract. It also works as a result field on a saved search. I’ve also trued SUM({fielda},2000) and I get the same result.

    Any help is appreciated.

    Thanks,

    Mike
    This is a cached copy. Click here to see the original post.

  • #9758 Score: 0

    k_dunc
    • Contributions: 0
    • Level 1

    Just by chance, have you tried CASTing or CONVERTing {fielda} to an ‘int’? Or perhaps try TO_NUMBER. Just give something like this a go:

    Code:
    TO_NUMBER({fielda}) + 2000

  • #9759 Score: 0

    SererraMike
    • Contributions: 0
    • Level 1

    Thanks Kirk.

    I tried just setting the field to an integer and I get the same result. I didn’t trying CAST or CONVERT though. I tried TO_NUMBER and it works after submit, but not after field edit. I went ahead and tried my original formula after submit, and it works correctly. Looks like the server is interpreting the formula differently than the client.

  • #9760 Score: 0

    michoel
    • Contributions: 0
    • Level 1

    If you workflow is executed client side (on field edit), your formula needs to be Javascript, not SQL

    Code:
    parseFloat({fielda}) + 2000

  • #9761 Score: 0

    SererraMike
    • Contributions: 0
    • Level 1

    Thanks Michoel,that seems to do the trick.

You must be logged in to reply to this topic.