6 Replies Latest reply on Sep 13, 2014 11:46 PM by ultranix

    Create new record if criteria is met



      Create new record if criteria is met


      In my sales CRM I sometimes forget to add next action (which is, basically, a new record in portal with date, time and type (call/meet/mail) filled, but INFO field empty.

      What I want to accomplish. In INFO field (a_info) of current record I always place comment of current action and put date (6 digit) and time of next action. For example, comment could look like this: "Decided to try and sell by himself for two weeks, so I will follow up on 140923 10.15" (i.e. on 23rd of September, 2014, 10:15 a.m.).

      Format of next action date and time is always the same - 6 digit date and 4 digit time, separated with a dot (141001 14.00).

      So, whenever such pattern is met, script trigger could execute onobjectexit and check, 1) whether pattern is present (because, if it's final action, no next action is planned) 2) if pattern is found - create new record with fields: a_date (from 6 digit date, i.e. 141001 - 1st of october, 2014), a_time (from 4 digit time separated by dot, i.e. 10.15 - 10:15 a.m.) and go to field a_type (call/meet/mail).

      How do I do that?

        • 1. Re: Create new record if criteria is met

          Is the comment itself entered by hand or entered via a script? My concern about hand entering this data is that data entry errors can keep any script that checks it for patterns from working correctly in cases where a typographical error occurred. If you use a script to enter this text in the first place (perhaps via selecting from a value list on a field with a script trigger), that same script can handle the additional tasks that you specify in this post.

          • 2. Re: Create new record if criteria is met

            I enter it by hand. And even if typo errors occur, script trigger will not close current layout, so I'll be able to fix it, at least I will see record created and will still have to enter a_type field - whether next action is a call/meet or mail.

            • 3. Re: Create new record if criteria is met

              my idea for calculation would be this (as most of the parts is text) - create variable, which substitutes a_info field all the numbers to let's say 9. And then I will search for Position of 999999 99.99 (substituted from 140910 10.15) and then I will be able to extract date and time of next action and put those in proper format. It's highly unlikely, that I will put 6 digit number for other than date, so that should work.

              • 4. Re: Create new record if criteria is met

                I was able to accomplish it.

                Though, I'm not quite happy, that I need to go to different layout (as portal is based from different table), create record of next action and after going back, I need to scroll down to the very last record in the portal.

                Is there a way to automate it via script that when script goes back to original layout, it would go to the last record of the portal and go to the specified field?

                • 5. Re: Create new record if criteria is met

                  Go to portal row [last] will scroll the last portal row into view. But be careful to first use go to object to put the focus on the correct portal.

                  But it's possible to create a new record in a portal's table without changing layouts if that's why your script changes layouts.

                  And I still think using a script to enter this text--either from a button click or via a script trigger equipped value list makes for simpler, faster and above all, more accurate data entry.

                  • 6. Re: Create new record if criteria is met

                    go to portal row [last] doesn't work for me. my script goes likes this: 1) go to layout [original] 2) go to object [Object Name: "Action History"']// I tried setting here object name for either all portal or just a field in a portal, same results // 3) Go to portal row [Select; Last]

                    I also tried go to portal row first/previous/next, but they all went to the very first row of the portal, not last.