Function using old version of value on User Input

Function using old version of value on User Input

Can anybody help me to understand this? I have the following (embarassingly) simple workflow that triggers on user input of Estimated_Fee:

input.Estimated_Fee_Per_Hour = input.Estimated_Fee / input.Estimated_Work_Time;

This works perfectly: when editing the record, I can see Estimated_Fee_Per_Hour change when I edit Estimated_Fee.

I want to convert this to become a function, which I have created as follows:

float ProjectsNTasks.CalculateEstimatedFeePerHour(Tasks task)
{
estimatedfeeperhour = input.task.Estimated_Fee / input.task.Estimated_Work_Time;
return estimatedfeeperhour;
}

This is called with the following workflow (also triggering on user input of Estimated_Fee):

input.Estimated_Fee_Per_Hour = thisapp.ProjectsNTasks.CalculateEstimatedFeePerHour(Tasks[ID = input.ID]);

However, for some reason, the function/workflow version doesn't use the 'live' version of Estimated_Fee when I update that field: it just uses the old value. I cannot see why the workflow version uses the live value but the function version doesn't.

Apologies that this is probably really simple but I just can't work it out despite much googling and debugging! (I have checked that the function is finding the right task and it appears to be acting correctly in every other way.)

Thanks in advance.



    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      Zoho CRM Plus Resources

        Zoho Books Resources


          Zoho Subscriptions Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly Resources


                  Zoho Creator Resources


                    Zoho WorkDrive Resources



                      Zoho Campaigns Resources

                        Zoho CRM Resources

                        • CRM Community Learning Series

                          CRM Community Learning Series


                        • Tips

                          Tips

                        • Functions

                          Functions

                        • Meetups

                          Meetups

                        • Kbase

                          Kbase

                        • Resources

                          Resources

                        • Digest

                          Digest

                        • CRM Marketplace

                          CRM Marketplace

                        • MVP Corner

                          MVP Corner




                          Zoho Writer Writer

                          Get Started. Write Away!

                          Writer is a powerful online word processor, designed for collaborative work.

                            Zoho CRM コンテンツ




                              ご検討中の方