Search This Blog

Saturday, 14 June 2014

Creating a New Sales order by copying existing Sales Order headers and lines in AX 2012

Hi Guys,

Today I am going to explain you , how to copy a existing sales order header and lines and create a new Sales Order.

Step 1:

Add two new control in Form level Design

1) SelectFromExistingSalesId (ControlType-CheckBox)
2)ExistingSalesId(ControlType-StingEdit)



Step 2:
Write a single line of code inside From Level init() method
ExistingSalesId.enabled(false);//Make the ExistingSalesId control Disable when the form open

Step 3:
write a piece of code inside SelectFromExistingSalesId checkbox Control modified() method




public boolean modified()
{
boolean ret;
ret = super();

if(SelectFromExisitngSalesId.value()==1)
{
   ExistingSalesId.enabled(true);
}
else
{
  ExistingSalesId.enabled(false);
}
return ret;

}
Step 4:
create a new method CreateSalesLines in the form level
 
 

public void createSalesLine(SalesId _salesId,ItemId _itemId)
{
SalesLine salesLine;
salesLine.clear();

salesLine.SalesId = _salesId;
salesLine.ItemId = _itemId;

salesLine.createLine(NoYes::Yes, // Validate
NoYes::Yes, // initFromSalesTable
NoYes::Yes, // initFromInventTable
NoYes::Yes, // calcInventQty
NoYes::Yes, // searchMarkup
NoYes::Yes);
}

Step 5:
write a piece of code inside ExistingSalesId Control modified() method

 
public boolean modified()
{
SalesTable salesTableBuff;
SalesLine salesLineBuff;
ItemId existItemId;
SalesId currentSalesId;
SalesIdBase existSalesId;

boolean ret;
ret = super();

existSalesId=ExistingSalesId.valueStr();//Gets the Existing Sales Id

select firstOnly SalesId,CustAccount from salesTableBuff

where salesTableBuff.SalesId == existSalesId;

SalesTable.CustAccount = salesTableBuff.CustAccount;

currentSalesId= SalesTable.SalesId; //Gets the Newly generated Sales Id

SalesTable_ds.object(fieldNum(SalesTable,CustAccount)).modified();

SalesTable.insert();

while select ItemId from salesLineBuff where salesLineBuff.SalesId == existSalesId
{

   existItemId=salesLineBuff.ItemId;
   element.createSalesLine(currentSalesId, existItemId);

}

return ret;

}

Output:
 
A New Sales Oder is Created
 
 


That's it ........

Happy Daxing....



7 comments:

  1. Real Magic Spells | How To Get Back Ex-Boyfriend or Ex-Girlfriend ☎ +27765274256

    Real Magic Spells for all purpose:

    Now you can benefit through the use of spells like Love Spells, Money Spells, Talismans, Charms, Prayers, Curses and Chants.
    MAGIC SPELLS can be spell cast for many purposes.
    Talismans and Charms work as powerful Ingredients. If you need any spiritual knowledge on the power of Spells and Magic you can always

    Powerful Magic Ring
    Love Spells.
    Casting of Simple and Effective Love Spell.
    Easy Love Spell.
    Spells for Attraction between two Lovers.
    Binding Love Spell.
    Get back Lost Lover Spell.
    Spells to Strengthen Love Relation.
    Lost Love Spell.
    Soul Mate Spell.
    Marriage Spell for a happy Married Life.
    Retrieve a Lost Love Spell
    Bring Back Your Love Spell.
    Gay Love Spells, Lesbian Love Spells.
    Anti-Love Spells, Divorce Spells, Break up Spells.
    How to Get Back Ex-Boyfriend, or Ex-Girlfriend.
    Casting Spells to Get Rid of Your Husband, Wife or Partner without Fights or them hating you.
    Magic Rings, Powerful Love Rings.
    Spells to Stop a Divorce.
    Voodoo Spells for Love.
    Love Return Spell.
    Money & Prosperity Spells

    Call Sheikh Hussein Now on ☎ +27765274256
    Email: sheikhhussein@protonmail.com

    ReplyDelete

  2. Must Win Court Case Ancient Powerful Spells ☎ +27765274256

    Court case spells to win any legal matter & stay out of jail. Legal spells to influence court verdict in your favor. Spells to get a court case dismissed or freeze a court. Get justice, fix your legal matters, get child custody & make the judge rule in your favor using voodoo court case spells & witchcraft court case spells.
    Stop a court case against you & make all your legal problems disappear using court case freezer spells. Prevent witnesses from testifying against you or make them give testimonies that do not implicate you using court case freezer spells. Win any court case with powerful court victory spells.
    Make the charges against you be dropped & win any legal case using powerful court case spells to have charges against you be dropped. My court case spells will help you have criminal & civil court cases against you be dropped. Spiritually influence the outcome of legal matters in your favor using court spells to have your charges dropped.
    Win any legal matter using legal spells that will align the ancestral spirits & universal forces on your side & change your destiny. Legal spells to freeze a court case, legal spells to have charges dropped against you, legal spells to help you get out of jail & legal spells to have a court case dismissed.
    Court case spells to help you get out of jail. Court case spells to cause your court case to be dismissed & get you out of jail. Doesn't matter how many years someone has been in jail my powerful court spells will help you legally get out of jail. Shield yourself from arrest & jail using court spells.
    Justice spells to make someone who has harmed you & gotten away with it to suffer pain & experience disaster. Voodoo justice spells & Wiccan justice spells.

    Call Sheikh Hussein Now on ☎ +27765274256
    Email: sheikhhussein@protonmail.com

    ReplyDelete

  3. Gay Love Protection Spells ☎ +27765274256

    Protection Spell
    Energy is energy! There really are no major differences in the casting of a love spell for a gay man or a lesbian woman, a straight man or heterosexual woman, the approach is pretty much the same. In my line of work when it comes to gay clients I have found a serious lack of understanding or compassion on the behalf of other practitioners for their gay and lesbian clients, being a gay man myself, I have worked hard over the years to develop a rapport with my gay and lesbian clientele, with that said I have also managed to maintain a positive rapport with my straight clients as well, working metaphysically on behalf of clients is easy once you develop a good understanding of the base needs and realize that we all are simply human and it is within our nature to love and to be loved.

    Now, aside from the fact that we are all human, whether we are straight or gay, when it comes to gay magic, there are a few minor tweaks in the magical approach that must be acknowledged and put into play to successfully unite or reunite same sex lovers. I have worked hard over the course of my magical career to develop a series of rituals and spells that I utilize specifically for my gay and lesbian clients.

    If you are a gay man or lesbian woman who is in need of attracting a new lover, or perhaps your desire is to reunite with an old flame, I can help you manifest your desires and realize your goal of bringing that special someone into your life. If you are single and looking to attract a brand new lover, click the link above to order a "Gay Love Spell" to get started. If you are a gay man or lesbian woman looking to reunite with your lover, you will need to order my . Either way I look forward to working with you and if you have any questions call the number listed on the website or use the contact form on the right side of the site to contact me.

    Call Sheikh Hussein Now on ☎ +27765274256
    Email: sheikhhussein@protonmail.com

    ReplyDelete
  4. Revenge Spells for Destroying Enemies, Stealth Attack ☎ +27765274256

    How to destroy enemy to take revenge from enemy?
    Usually, it becomes difficult for people for how to take revenge from enemy? If you are from the one, with whom enemy had done a bad and worse thing with you. If you feel that the power of your enemy in front of your is more, then black magic is especially recommended for the people like yours. The user of black magic has been the most powerful person at that time when he does make its use, even for whatever the matter and for whatever the objective is.
    The black magic has been known as dominant that it can achieve everything for the person. As also if you want to know how to destroy or control enemy by black magic then you can consult with our astrologer.

    How to take revenge from your enemy to make him suffer? If you wish that your enemy need to suffer for what does he had done with you, but you have not been finding the right way for how to make your enemy suffer? Then it is the right time to know how to take revenge from your enemy? As nothing has been made that could provide you reprisal for what does it has done wrong with you by the side of your enemy. Your enemy will have to suffer now, you and I both know well that if you go to the door of law ten their it doesn’t guarantee that you will get to have justice as you had wanted. But this thing is not to include with our astrologer if you want revenge that you had desire than you will absolutely get to have.

    How to make someone sick and die
    If your issue is little different, as you are not satisfied by the success of your enemy or someone had stolen your love from you or whatever the reason that creates anger in your mind for your enemy. How to make some sick and die is well learned in knowledge by our astrologer. Although you can make your enemy become ill and one day his illness will become the reason for his death and you will get to have relief from your enemy.

    How to destroy your enemy Black Magic Black Magic.
    How to kill your enemy by using Black Magic.
    How to destroy an enemy?
    How to get revenge from an enemy?
    How to make someone sick and die?
    How to make your enemy suffer?

    Call Sheikh Hussein Now on ☎ +27765274256
    Email: sheikhhussein@protonmail.com

    ReplyDelete
  5. Powerful Sangoma With Spiritual Powers in Johannesburg ☎ +27765274256

    Established herbalist working discreetly from home, exclusive remedies and solutions to both your stubborn ailments and problems, you won't ever look further.

    Are you looking for the best online help? Have you been searching all over the Internet to find professional help? Then you have come to the right place contact me now. I am determined to offer exactly what you’re seeking. Fast and everlasting results!

    -Are you there with bank debts?
    -Do you want to see miracles of money multiplication?
    -You want promotion/favor at work?
    -You want to attract customers in your business?
    -Do you want to start business but money is not enough?
    -Do you have financial problems?
    -Do you have relationship/marriage problems?
    -Are you impotent?
    -They cast spell on you?
    -Do you want to be in luxurious life?
    -Your business becomes stagnant?
    -Are you failed to get your pension?
    -Are your children performing badly in class?
    -Are you looking for job?
    -Do you need any special powers?

    Call Sheikh Hussein Now on ☎ +27765274256
    Email: sheikhhussein@protonmail.com

    ReplyDelete

  6. Powerful Traditional Healer With Spiritual Powers in Johannesburg ☎ +27765274256

    Some of the services I offer include

    Sangoma/Spiritual Powers to Bring Back Love Lover
    Fix all your financial problems
    Business boost.
    Remove all kind of Witchcraft and Bad Luck from Homes Businesses & Relationships
    Bring Back A Lost Lover,
    Lost Lover Spell,
    Stop/Reverse a Divorce,
    Spells to Make Him/her Marry Me,
    Stop Cheating Spell,
    Unfinished Job from previous Healer,
    Do you seek To split a relationship, cause dissension, trouble?*
    Do you feel like you are losing it?*
    Do you seek success, power, fulfilment, happiness at home or at work?*
    Do you seek To control a person and have them do your binding?*
    Do you feel you have no future?*
    Marriage Advice* Traditional
    Do you seek protection, security, peace of mind?*
    Do you seek revenge, retribution, want to even the score?*
    Are you constantly afflicted by bad luck?*
    For Relationship and Love Advice*
    Do you seek love, friendship, want a past lover to return or a present lover to commit?*
    Have you lost the zeal for life?

    With the help of a wide range of my carefully crafted Muthi, chants and prayers, I can help you overcome your love challenges and many other difficulties.

    If you have any problem in your life because of others then use the black magic technique. By the Black Magic specialist Sheikh Hussein actually makes a person incapable of using mind; it puts a block on the person's wisdom and intelligence and thus person feels a kind of mental block. He seems Disturbance in sleep, bad dreams and negative thoughts is to come in the person's mind & falling in the depression .These things makes the person's worst. Most of the persons do not much aware about this ultimate magic. As, they think it to be used for negative purposes. But, it is the incomplete knowledge, as black magic is helpful for positive factors also.

    Call Sheikh Hussein Now on ☎ +27765274256
    Email: sheikhhussein@protonmail.com

    ReplyDelete
  7. Spell to fix your broken marriage or relationship problem or after a divorce or Breakup,I was recently scam by two of them, until one faithful day i meet a man called Dr Oselumen who help me to get back to the father of my kid after we have been separated for two years,I only pay for the items required for the spell and he cast the spell for me within 24hours my ex husband called me and beg me to forgive him for everything until the end of the world he will never leave me again we are together.if you need a real and quick love spell or you are passing through pregnancy problem Dr Oselumen is the answer, Pleas e if any body needs. LOVE SPELL,LOTTERY,PREGNANCY SPELL, DIVORCE SPELL,STOP COURT CASE AND WIN ANY COURT PROBLEM,DEATH SPELL,BUSINESS SPELL AND MANY MORE YOU MAY NEED. Email him now for your own help. via email droselumen@gmail. com add him on whatsapp line or call +2348054265852. 

    ReplyDelete