Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

The weirdest coding PITA I've found in SanScript / Dexterity yet

Posted on by 294

Hey Everyone:

[TL;DR my SanScript code is blanking out the comment ID field (and a couple of other fields) on SOP_Entry.  I don't know why.

I've got something going on that I could really use some help with.  A customer has requested that I place the SOP UDFs on the main SOP entry screen, read-only is fine.  They want them displayed because the users are checking that the integration into SOP (from Web Services) is providing complete information, and currently the users have to - for each invoice - go through the Goto --> User Defined window to ensure that the UDFs are populated.  Note: this isn't a discussion about whether or not their process is correct...  I've already provided reports and alternate methods of investigation, but this is what they want.

I took the Dynamics.DIC, modified the window to make an alternate window, layer a small amount of code, and found this wild behavior.

This is the screen as it is now, and I've highlighted the fields which get blanked out or have other problems:

pastedimage1612449247372v1.png

When the user goes into the UDF screen and changes anything, these fields get blanked out after running this code:

run script 'SOP Number' of window SOP_Entry of form SOP_Entry;

What I don't understand is why this particular code would / could BLANK fields.  (This script is called by a trigger on SetUserDefinedValues of form sopUserDefined, after original.)

I've run a script profiler to see what the heck is happening, but I can't see anything unusual.

Anyone have any thoughts?

Thanks.

-J

PS there are no other customizations on this window.

PPS is this the right script off of which to key to detect and/or cause a window refresh on this window?  It seemed like the best candidate.

Categories:
  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,926 Most Valuable Professional on at
    RE: The weirdest coding PITA I've found in SanScript / Dexterity yet

    Hey James

    Don't feel bad.... I have doing this for almost 30 years. Experience must count for something.

    David

    PS: OMG I feel old now.

  • James McCullough Profile Picture
    James McCullough 294 on at
    RE: The weirdest coding PITA I've found in SanScript / Dexterity yet

    Thank you David.  As usual, your answer is on point, seemingly correct, and I feel like a tool.  One day, I swear...  One day, I'll get this right...  LOL

  • Verified answer
    David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,926 Most Valuable Professional on at
    RE: The weirdest coding PITA I've found in SanScript / Dexterity yet

    Hi James

    I think you need to work on a new approach.

    The header for the document is not saved until to save it.  It is updated on the window and/or table buffer to update totals etc. when lines are changed or added, but not saved.

    So I you re-read from the table after adding or changing a line, the updates to all the header fields like totals will be lost and the document header will go out of sync with the lines.

    If you need to update specific fields then code that manually.

    As for using Temp Control Number to Zoom to a record rather than the primary key, this is covered in the Dexterity training.  If there is an existing record already being shown, overwriting the primary key prevents the existing data being saved before the new record is loaded.

    Regards

    David

  • James McCullough Profile Picture
    James McCullough 294 on at
    RE: The weirdest coding PITA I've found in SanScript / Dexterity yet

    What I was trying to achieve was an overall screen redraw when coming out of the SOP UDF window, as the information on the alternate SOP Entry window might have changed.  I keyed off that script because it seemed like the most logical place to execute a screen refresh and since the SOP Number likely would not have changed, it would be the least invasive.

    Is there a reason that I would opt to look at local fields as opposed to more general fields when I'm doing things like this?  I figured it would be better to look at the higher level variables / scripts first...

    Thanks David!

    -J

  • Suggested answer
    David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,926 Most Valuable Professional on at
    RE: The weirdest coding PITA I've found in SanScript / Dexterity yet

    Hi James

    Why are you running SOP Number?

    If you want to pull up a record set and run the (L) Temp Control Number  and (L) Temp Type fields

    Regards

    David

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans