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

Check for duplicated SIN with sanscript and EOne Extender

(1) ShareShare
ReportReport
Posted on by 50

Hello all,

My company is using  Canadian Payroll, in addition to eOne's eXtender product.

I am trying to create a sanscript script which will run under an eXtender action, that will open a prompt whenever our Payroll enters in a SIN that is already in CPY10100 (aka an employee who already exists).

I copied an existing template from eOne found here: https://www.eonesolutions.com/extender/downloads/#Templates or below

local text lt_sql;
local long ll_sql_connection, ll_status;
local integer li_sop_type;
local string ls_sop_number;

if empty(<Customer PO Number>) or empty(<Customer Number>) then
    abort script;
end if;

SQL_Connect(ll_sql_connection);

lt_sql = "USE " + 'Intercompany ID' of globals;
SQL_Execute(ll_sql_connection, lt_sql);

{check if customer and po combination exists in work table}
lt_sql = "select SOPTYPE, SOPNUMBE from SOP10100 where ";
lt_sql = lt_sql + "CUSTNMBR = " + SQL_FormatStrings(<Customer Number>) + " and ";
lt_sql = lt_sql + "CSTPONBR = " + SQL_FormatStrings(<Customer PO Number>) + " and ";
lt_sql = lt_sql + "not (SOPNUMBE = " + SQL_FormatStrings(<SOP Number>) + " and SOPTYPE = " + str(<SOP Type>) + ")";

ll_status = SQL_Execute(ll_sql_connection, lt_sql);
if ll_status = 0 then
    ll_status = SQL_FetchNext(ll_sql_connection);
    if ll_status = 0 then
        SQL_GetData(ll_sql_connection, 1, li_sop_type);
        SQL_GetData(ll_sql_connection, 2, ls_sop_number);
    end if;
end if;

if empty(ls_sop_number) then
    {check if customer and po combination exists in history table}
    lt_sql = "select SOPTYPE, SOPNUMBE from SOP30200 where ";
    lt_sql = lt_sql + "CUSTNMBR = " + SQL_FormatStrings(<Customer Number>) + " and ";
    lt_sql = lt_sql + "CSTPONBR = " + SQL_FormatStrings(<Customer PO Number>);
    ll_status = SQL_Execute(ll_sql_connection, lt_sql);
    if ll_status = 0 then
        ll_status = SQL_FetchNext(ll_sql_connection);
        if ll_status = 0 then
            SQL_GetData(ll_sql_connection, 1, li_sop_type);
            SQL_GetData(ll_sql_connection, 2, ls_sop_number);
        end if;
    end if;
end if;

if not empty(ls_sop_number) then
    case ask("A document has already been entered for this customer with this purchase order number.", "Open Inquiry", "Continue", "Delete")
        in [ASKBUTTON1]
            open form SOP_Document_Inquiry;
            if isopen(form SOP_Document_Inquiry) then
                'Sort By' of window SOP_Document_Inquiry of form SOP_Document_Inquiry = 1;
                run script 'Sort By' of window SOP_Document_Inquiry of form SOP_Document_Inquiry;
                'All Or Range' of window SOP_Document_Inquiry of form SOP_Document_Inquiry = 1;
                run script 'All Or Range' of window SOP_Document_Inquiry of form SOP_Document_Inquiry;
                'Start SOP Number' of window SOP_Document_Inquiry of form SOP_Document_Inquiry = ls_sop_number;
                'End SOP Number' of window SOP_Document_Inquiry of form SOP_Document_Inquiry = ls_sop_number;
                'Include GB' of window SOP_Document_Inquiry of form SOP_Document_Inquiry = 1;
                run script 'Include GB' of window SOP_Document_Inquiry of form SOP_Document_Inquiry;
                run script 'Redisplay Button' of window SOP_Document_Inquiry of form SOP_Document_Inquiry;
            end if;
        in [ASKBUTTON3]
            {run script delayed 'Delete Button' of window SOP_Entry of form SOP_Entry;}
    end case;
end if;

SQL_Terminate(ll_sql_connection);

I modified it to be the following ,and it is 'valid' according to the extender window. However, no popup appears when a duplicate SIN is entered or changed in a test client.

local text lt_sql;
local long ll_sql_connection, ll_status;
local string ls_sin_number;

if empty(<P_Employee_ID>) or empty(<P_Social_Insurance_Number>) then
    abort script;
end if;

SQL_Connect(ll_sql_connection);

lt_sql = "select Distinct PSocialInsuranceNumber from CPY10100 where ";
lt_sql = lt_sql + "PSocialInsuranceNumber = " + SQL_FormatStrings(<P_Social_Insurance_Number>);

ll_status = SQL_Execute(ll_sql_connection, lt_sql);
if ll_status = 0 then
    ll_status = SQL_FetchNext(ll_sql_connection);
    if ll_status = 0 then
        SQL_GetData(ll_sql_connection, 1, ls_sin_number);
    end if;
end if;


if not empty(ls_sin_number) then
    ask("A employee already exists with this SIN.", "Continue","Continue","Continue");
end if;
SQL_Terminate(ll_sql_connection);

Any help or suggestions would be great!

Thanks!

Categories:
I have the same question (0)
  • DexDev Profile Picture
    100 on at
    RE: Check for duplicated SIN with sanscript and EOne Extender

    Hi,

    If you are looking for a code assistance, kindly let me know. 

    Get help with your project here.

    J.

  • Beat Bucher  GP Geek  GPUG All Star Profile Picture
    28,058 Moderator on at
    RE: Check for duplicated SIN with sanscript and EOne Extender

    Hi,

    I don't quite get the question of your post ? you found some code on eOne's site for Extender, but don't know how to implement it ? is that the purpose of the question ?

    Please advise to get a more precise answer.

    Thanks

  • jgilker Profile Picture
    50 on at
    RE: Check for duplicated SIN with sanscript and EOne Extender

    Hi Beat,

    I will reword my question. I am not sure what is wrong in my code. Any tips or suggestions to make the code work the way I am wanting it to work would be greatly appreciated.

    Sadly, I do not have a Dynamics / Sanscript IDE, so I cannot easily test this code out. If you know of any IDE that can handle Sanscript, could you let me know? That would also be appreciated.

  • Suggested answer
    Beat Bucher  GP Geek  GPUG All Star Profile Picture
    28,058 Moderator on at
    RE: Check for duplicated SIN with sanscript and EOne Extender

    As I said, one way to get this working without too much efforts and investments is to use GPPT (winthropdc.wordpress.com/.../) and see if you can achieve the same result with less coding.. GPPT's dev module supports SQL, VB, Dexterity, C# and possibly also sanscript.

    I'll bet David Musgrave will be able to assist with your problem.. 

    BTW, The GP SDK and Dexterity dev environment is free to install along your GP setup, and David also provides a free library called VSIT (Visual Studio Integration Toolkit) that allows .NET developers to natively access GP functions within Visual Studio.

  • Almas Mahfooz Profile Picture
    11,009 User Group Leader on at
    RE: Check for duplicated SIN with sanscript and EOne Extender

    Dexterity is Sanscript IDE.

    I am confuse, if you don't have the IDE then where you have this code and checking of message pop up or not?

  • Verified answer
    David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    14,069 Most Valuable Professional on at
    RE: Check for duplicated SIN with sanscript and EOne Extender

    Hi Josh

    I took the liberty of coding an example GP Power Tools - Developer Tools module project which handles your requirement (and more).

    I have emailed it to you. If anyone else is interested, please contact me using the Contact Us page (https://www.winthropdc.com/contact.htm)

    I will eventually publish this example as a blog article on http://www.winthropdc.com/blog 

    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

Responsible AI policies

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

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 1,882

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 525 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans