OPINION
EUBANK, Presiding Judge.This appeal involves the procedure under the Arizona Probate Code (Code), A.R.S. §§ 14-1102 et seq. for commencing a formal testacy proceeding to set aside the informal probate of a will.
Madge Torstenson (the decedent) died on March 2, 1976. Her will and two codicils were admitted to informal probate later that month. In June 1976, appellants Ellis and Leiby, her daughters, filed a verified petition1 with the probate court in which they sought an order “[t]hat the said instruments be denied probate and declared not to be the Last Will and Testament or codicils of said deceased [Madge Torstenson].”
In March of 1978, appellants moved for leave to amend their petition, and the trial *375court denied the motion. Appellees moved to dismiss the petition and in April of 1978 the court granted the motion and dismissed appellants’ action. It ruled that it lacked jurisdiction to grant the relief sought in the petition because appellants had not filed a formal testacy proceeding in compliance with A.R.S. § 14-3401 et seq. (see Uniform Probate Code (U.L.A.) § 3 — 401 et seq.) Appellants appeal from the dismissal judgment and the order awarding costs.
Appellants’ first contention is that the trial court erred in ruling that it lacked jurisdiction to grant the relief sought in their petition. We agree. A.R.S. § 14-1302 (see Uniform Probate Code (U.L.A.) § 1-302) defines the subject matter jurisdiction of the superior court in probate matters. It provides:
A. To the full extent permitted by the constitution, the court has jurisdiction over all subject matter relating to:
1. Estates of decedents, including construction of wills and determination of heirs and successors of decedents, and estates of protected persons.
2. Protection of minors and incapacitated persons.
3. Trusts.
B. The court has full power to make orders, judgments and decrees and take all other action necessary and proper to administer justice in the matters which come before it including power to enforce orders against a fiduciary by contempt proceedings and to compel action by a fiduciary by body attachment.
In Gonzalez v. Superior Court, 117 Ariz. 64, 570 P.2d 1077 (1977) our Supreme Court said:
From the foregoing language [A.R.S. § 14-1302 (see Uniform Probate Code (U.L.A.) § 1-302)] we conclude that by enacting the new probate code the legislature intended to confer upon the Superior Court sitting in probate its full constitutional jurisdiction in matters which might arise affecting estates.
Id. at 66, 570 P.2d at 1079. Moreover, after appellants filed their petition, but before the trial court granted appellees’ motion to dismiss, the legislature amended A.R.S. § 14-3105 (see Uniform Probate Code (U.L.A.) § 3-105) in part to read:
The court has jurisdiction of any other action or proceeding concerning succession or to which an estate, through a personal representative, may be a party
Appellants’ petition contesting the will concerned succession and made Madge Torstenson’s estate a party through her personal representative, Valley National Bank. We therefore conclude that the trial court erred in ruling that it lacked jurisdiction over the matters raised in appellants’ petition.
By itself, the trial court’s error concerning its jurisdiction is not reversible error. Only errors which prejudice a party’s substantial rights justify reversing a trial court’s judgment. Seely v. McEvers, 115 Ariz. 171, 564 P.2d 394 (App.1977). If the trial court reaches the correct result on the merits for an erroneous reason, the error is harmless and its judgment must be affirmed. See In re Estate of Beaman, 119 Ariz. 614, 583 P.2d 270 (App.1978). For the reasons stated hereafter, we conclude the trial court correctly dismissed appellants’ petition, and we accordingly affirm the judgment and award of costs.
The decedent’s will was admitted to informal probate in March of 1976. “Informal probate is conclusive as to all persons until superseded by an order [entered] in a formal testacy proceeding,” (A.R.S. § 14-3302) (see Uniform Probate Code (U.L.A.) § 3-302). Thus an informal probate order can only be set aside by an order entered in a formal testacy proceeding. Effland, Arizona Probate Code Practice Manual, § 5-6 at page 5-10 (1973). The question before us then, is whether appellants properly commenced a formal testacy proceeding by filing their petition contesting the will in the informal probate.
“A formal testacy proceeding is litigation to determine whether a decedent left a valid will.” A.R.S. § 14-3401(A) (see Uniform Probate Code (U.L.A.) § 3 — 401). The Code provides that the proceeding is com*376menced by filing a petition, and it prescribes the persons entitled to notice of the petition and the manner of giving them notice. See A.R.S. § 14-3403 (see Uniform Probate Code (U.L.A.) § 3-403).
A.R.S. § 14-3403(A) provides:
A. Upon commencement of a formal testacy proceeding, the clerk shall fix a time and place of hearing. Notice shall be given in the manner prescribed by § 14-1401 by the petitioner to the persons specified in this section and to any additional person who has filed a demand for notice under § 14-3204. Notice shall be given to the following persons: The surviving spouse, children and other hem of the decedent, the devisees and executors named in any will that is being, or has been, probated, or offered for informal or formal probate in the county, or that is known by the petitioner to have been probated, or offered for informal or formal probate in another jurisdiction, and any personal representative of the decedent whose appointment has not been terminated. Notice may be given to other persons. In addition, the petitioner shall give notice by publication in accordance with § 14-1401, subsection A, paragraph 3. (Emphasis added).
A.R.S. § 14-1401(C) (see Uniform Probate Code (U.L.A.) § 1-401) provides that “[p]roof of the giving of notice shall be made at or before the hearing and filed in the proceeding.”
The record shows that only the personal representative, Valley National Bank, received notice of appellants’ petition contesting the will. Nothing in the record indicates that appellants ever published notice of the petition. In light of appellants’ failure to comply with the Code’s notice provisions, the trial court correctly ruled that they had not filed a formal testacy proceeding in compliance with the Code, and properly dismissed their petition.
Appellants also contend that the procedure outlined in the Code, A.R.S. §§ 14-3401 — 14-3402, is not the exclusive method of commencing a formal testacy proceeding. They base their argument largely on the phrase “[a] formal testacy proceeding may be commenced . . .” (Emphasis added). They contend that the legislature would have used the word “shall”, not the word “may”, if it intended the procedure in the Code to be the exclusive way to bring a formal testacy proceeding. We disagree.
A.R.S. § 14-1102(B) (see Uniform Probate Code (U.L.A.) § 1-102) provides that two purposes of the Code are (1) simplifying the law of decedents’ estates, and (2) making this law uniform among the states. In light of the Code’s express goals of simplicity and uniformity, we decline to find an intent to allow various methods of bringing a formal testacy proceeding solely because the word “may” is used instead of the word “shall.” Moreover, even assuming that the legislature did not intend the Code’s procedure to be exclusive, appellants’ failure to notify anyone other than the decedent’s personal representative of their petition contesting the will justified the probate court in dismissing their petition.
Appellants’ final contention is that the trial court erred in denying their motion for leave to amend the petition. A motion for leave to amend a pleading is addressed to the sound discretion of the trial court, and we will not overturn the trial court’s decision on appeal absent a clear abuse of that discretion. Cathemer v. Hunter, 27 Ariz.App. 780, 558 P.2d 975 (1976). While leave to amend a pleading should be freely granted in the interests of justice, the right to amend is not automatic. The United States Supreme Court has said:
In the absence of any apparent or declared reason — such as undue delay, bad faith or dilatory motive on the part of the movant, repeated failure to cure deficiencies by amendments previously allowed, undue prejudice to the opposing party by virtue of allowance of the amendment, futility of amendment, etc., — the leave sought should, as the rules require, be “freely given.”
Foman v. Davis, 371 U.S. 178, 182, 83 S.Ct. 227, 230, 9 L.Ed.2d 222, 226 (1972). (Em*377phasis added). Conversely, it is not an abuse of discretion to deny leave to amend when some or all of the circumstances above exist.
Appellants filed their petition contesting the will in June of 1976, and the appellee filed a response in July of 1976. The response alleges that appellants failed to comply with the requirements in A.R.S. §§ 14-3401, 14-3402, 14-3403, and 14-3404. Thus, the record shows appellants had notice of the defects in their petition almost two years before they filed their motion for leave to amend in March of 1978. Nothing in the record indicates any compelling reason for the delay. In our opinion, this constitutes an undue delay in filing the motion, and it was not an abuse of discretion by the trial judge to deny the motion to amend.
Leave to amend a pleading is also appropriately denied “when the proffered amendment could not affect the outcome of the litigation, that is, when on its face it is legally insufficient.” Home Insurance Company v. Balfour-Guthrie Insurance Company, 13 Ariz.App. 327, 328, 476 P.2d 533, 534 (1970); appeal dismissed, 107 Ariz. 296, 486 P.2d 778 (1971). Appellants’ motion for leave to amend requests the Court to allow them to amend the petition to “conform with any of the requirements of Section (sic) 14-3401, 3402.” The motion does not mention A.R.S. § 14-3403, nor does it refer to giving notice to the parties enumerated in the statute. On its face, the amendment is insufficient to cure the defect. Under these circumstances we cannot say the trial court clearly abused its discretion in denying leave to amend the petition.
For the foregoing reasons, the judgment and order of the trial court are affirmed.
OGG, C. J., Division 1, and STEVENS, J., retired, concur.. Appellants refer to this petition as a petition contesting will.