Sunday, March 11, 2018

How to auto populate a people picker field based on another people picker field?

Refer the below link for details:
https://community.nintex.com/thread/17850-how-to-auto-populate-a-people-picker-field-based-on-another-people-picker-field
NWF.FormFiller.Events.RegisterAfterReady(function () { 
     NWF$(document).ready(function() {
          NWF$("#"+var_People1).change(function() {
               // first wipe out existing state of the field
               NWF$("#"+var_People2).val("");
               NWF$("#"+var_People2).closest("div.ip-container").find("div.ip-item").each(function() { NWF$(this).remove(); });
               // then fill it with the scope set in field 1
               NWF$("#"+var_People2).val(NWF$(this).val());
               NWF$(this).closest("div.ip-container").find("div.ip-item").each(function() { NWF$("#"+var_People2).closest("div").find("textarea").before(NWF$(this).clone(true,true)); });
          });
    });
});

Thursday, September 14, 2017

Container and unbounded string fields are not allowed in a WHERE expression.

I had a requirement to store huge data of xml into AX table i.e. I used string size as [MEMO].
Response1, Response2 & Response3 are Memo Fields.

Now my requirement is to perform to select some data based on where conditions checking Response 1, Response 2 &; Response 3 parameters but it gives me Error

  while select * from appLog
            where appLog.ReceiptNo == ""  && appLog.Response1 != "" && appLog.Response2 != "" && appLog.Response3 == ""
        {
                resultSet.addEnd(appLog.Response2);
       
        }


Container and unbounded string fields are not allowed in a WHERE expression.

Note: After finding error details I came to know you can not use MEMO fields in where clause and have to use IF condition .

Therefore the query was changed as below.

  while select * from appLog
            where appLog.ReceiptNo == ""
        {
            response1 = appLog.Response1;
            response2 = appLog.Response2;
            response3 = appLog.Response3;
         
            if(response1 != "" && response2 != "" && response3 == "")
            {
                resultSet.addEnd(appLog.Response2);
            }
        }


Tuesday, August 22, 2017

X++ code to Count Records in Query


Refer below link

http://learnax.blogspot.qa/2010/09/x-code-to-count-records-in-query.html

Dialog box in AX

Refer below link

https://axchaitu.wordpress.com/2013/07/26/get-dialog-box-of-yes-or-no-for-any-operation-by-user-in-ax/

unable to save method … Dynamics Ax 2012 R3

Refer Below Links

https://community.dynamics.com/ax/b/alirazatechblog/archive/2015/01/19/unable-to-save-method-dynamics-ax-2012-r3

https://www.tech.alirazazaidi.com/unable-to-save-method-dynamics-ax-2012-r3/

Tuesday, August 1, 2017

How to use .NET DLL in AX

Please refer the below blog com

You can create .net class library project.
Register the .dll into dynamic AX

Code:

static void PushNotification(Args _args)
{
   
   CodeAccessPermission permission;
   PushNotificationAPI.PushNotification push;
 ;
   

 permission = new InteropPermission(InteropKind::CLRInterop);
 permission.assert();
 push = new PushNotificationAPI.PushNotification();
 push.SendAndroidPushNotification("Great Ashraf", "dZzhpCacCMQ:APA91bEMAMorxr9hCGoSx5WCrR1eocjxPY30IDn9V0aWblp1lr6Bb2XQkS0glflLZt5x0LMXKKTbqydLoXxKgpBSYGy9SigEZBqyASxuRGSUBARTvFfx-WUmliBPV1cMAkDxSyJ4kTBM");
   
}
https://nasheet.wordpress.com/2012/05/21/how-can-we-use-dll-in-ax/

Thursday, January 5, 2017

jQuery Popup




 







                       
                   

Tuesday, August 23, 2016

Dynamics AX - The value 1 is not found in the map

Issue Resolved. The problem was in the progress bar. The workaround is to use the SetTotal(someinteger) method instead of the incCount() method .

Monday, August 8, 2016

Ferranti DateTime Conversion to Date

Ferranti  DateTime Conversion to Date

IIF (b.bilstartdate = '0','0',CONVERT(VARCHAR(12),DATEADD(day, -2, (36526+(LEFT( b.bilstartdate + 288000000000,11)-63082281600)/(24*3600))),5) )as startdate

Thursday, August 4, 2016

Executing SQL Query in Dynamics AX

X++ language supports a number of ways to execute native SQL against any SQL data source.

Note: don't forget to set RunOn Property to Server of the class. Job:

static void BillingQuery(Args _args)
{
    RunSqlQuery q = new RunSqlQuery();
    q.RunSqlQueryMethod();

}

Class:

class RunSqlQuery
{
}

public void RunSqlQueryMethod()
{
     str sql;
    Connection conn;
    SqlStatementExecutePermission permission;
    Statement Stmt;
    ResultSet R;
    str result;
    ;
    sql = "select ACCOUNTNUM from custTable";

    conn = new Connection();
    permission = new SqlStatementExecutePermission(sql);
    permission.assert();

    Stmt = conn.createStatement();
    R = Stmt.executeQuery(sql);
    while ( R.next() )
    {
        result =  R.getString(1);
    }

    // the permissions needs to be reverted back to original condition.
    CodeAccessPermission::revertAssert();
}

Below the useful links.

http://blog.rahulsharma.in/2010/04/dynamics-ax-sqlstatementexecutepermissi.html

https://msdax.wordpress.com/2010/06/21/executing-sql-directly-from-x/

Wednesday, August 3, 2016

Tuesday, July 26, 2016

Debugging Managed Code - Dynamics AX

I am just sharing video to know how to debug and deploy managed code using Visual studio.



Monday, September 7, 2015

Disable ctrl + p keys to prevent

Disable ctrl + p keys to prevent

Reference: http://forums.asp.net/post/4012820.aspx

function disableCtrlKeyCombination(e)
{
        //list all CTRL + key combinations you want to disable
    var forbiddenkeys = new Array('a', 'n', 'c', 'x', 'v', 'j', 'p');
        var key;
        var isCtrl;
        if(window.event)
        {
                key = window.event.keyCode;     //IE
                if(window.event.ctrlKey)
                        isCtrl = true;
                else
                        isCtrl = false;
        }
        else
        {
                key = e.which;     //firefox
                if(e.ctrlKey)
                        isCtrl = true;
                else
                        isCtrl = false;
        }


        //if ctrl is pressed check if other key is in forbidenKeys array
        if(isCtrl)
        {
                for(i=0; i<forbiddenkeys.length; i++)
                {
                        //case-insensitive comparation
                    if (forbiddenkeys[i].toLowerCase() == String.fromCharCode(key).toLowerCase())
                        {
                                alert("Key combination CTRL + "
                                        +String.fromCharCode(key)
                                        +" has been disabled.");
                                return false;
                        }
                }
        }
        return true;
    }
    var oEventUtil = new Object();
    oEventUtil.AddEventHandler = function (oTarget, sEventType, fnHandler) {
        if (oTarget.addEventListener) {
            oTarget.addEventListener(sEventType, fnHandler, false);
        } else if (oTarget.attachEvent) {
            oTarget.attachEvent('on' + sEventType, fnHandler);
        } else {
            oTarget['on' + sEventType] = fnHandler;
        }
    }
    var oTB = function () {
        document.getElementById("TextBox1").focus();
    }
onkeypress="return disableCtrlKeyCombination(event);" onkeydown="return disableCtrlKeyCombination(event);" >