web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

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

(1) ShareShare
ReportReport
Posted on by 371

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:
I have the same question (0)
  • Suggested answer
    David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    14,082 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

  • James McCullough Profile Picture
    371 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

  • Verified answer
    David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    14,082 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
    371 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

  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    14,082 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.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 596 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 570 Super User 2025 Season 2

#3
CU05031448-0 Profile Picture

CU05031448-0 556

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans