
404 A.2d 833 (1979)
Richard ROMANELLO et al.
v.
Robert H. MAGUIRE et al.
Richard ROMANELLO et al.
v.
Vinnie RICHMOND.
Nos. 77-210-Appeal, 77-309-Appeal.
Supreme Court of Rhode Island.
August 14, 1979.
Hinckley, Allen, Salisbury & Parsons, Providence, Thomas D. Gidley, Robert C. Bruns, for plaintiffs.
V. James Santaniello, Providence, for Robert H. Maguire et al.
Stone & Clifton, Walter R. Stone, Edward C. Clifton, Providence, for Stepping Stone Enterprises, Ltd. and Henry Davis.

OPINION
BEVILACQUA, Chief Justice.
These are civil actions in which the promoters of the Folk-Blue Grass Music Festival *834 (the festival), Richard Romanello and American Music Productions, Inc., the plaintiffs herein, seek to recover damages for the nonperformance of the festival at Stepping Stone Ranch, West Greenwich, Rhode Island, on July 24-27, 1975. We have consolidated these two cases for the purposes of this decision.
Both cases arise from the same factual situation. On April 4, 1975, Stepping Stone Enterprises, Ltd. submitted an application, along with a license-fee check, to the West Greenwich Town Council (town council) for an entertainment license for the festival activities. On July 9, 1975, the town council conducted a public meeting regarding the application and following this meeting voted to deny the application for all performances at Stepping Stone Ranch.
As a result of the town council's actions, plaintiffs instituted these two actions in Superior Court. The plaintiffs initially filed a three-count amended complaint against the town council, Stepping Stone Enterprises, Ltd. and Henry V. Davis.[1] In Counts I and II of their complaint, plaintiff alleged that the town council had acted in an illegal manner in denying the application and that the denial violated the terms of G.L.1956, §§ 5-22-1, -2, -4[2] (the statute), and the West Greenwich Town Ordinance[3] relating to the licensing of entertainment activity (the ordinance). The plaintiffs further contended that the town council was estopped from denying the application because the town council neither rejected nor returned the license-fee check[4] submitted with the application. Finally, plaintiffs alleged that both the statute and the ordinance *835 violated plaintiffs' rights to due process of law as guaranteed by the Fourteenth Amendment. In Count III, plaintiffs alleged that Stepping Stone had misrepresented to them that the entertainment license had been issued by the town council. The plaintiffs further contended that Stepping Stone knew this representation was false and that plaintiffs relied detrimentally upon this statement.
The plaintiffs also filed a separate two-count complaint against Vinnie Richmond, in his capacity as Treasurer of the Town of West Greenwich (town treasurer) pursuant to the provisions of G.L.1956 (1970 Reenactment) § 45-15-5.[5] In this complaint, plaintiffs incorporated most of the same allegations that they had made against the town council in their earlier action.
In the first action, the town council and Stepping Stone filed motions to dismiss the complaint pursuant to Super.R.Civ.P. 12(b)(6). Stepping Stone, however, also chose to file an answer to the complaint. This answer contained a cross-claim against the town council. The town council also moved to dismiss the cross-claim. After hearings thereon, the trial court granted both of the town council's motions to dismiss.
In the second action, the town treasurer also made a motion to dismiss the complaint pursuant to Super.R.Civ.P. 12(b)(6). After a hearing, the motion was granted by the trial court.
The issue before us is whether the trial court erred in granting the three motions to dismiss.
Because the complaints filed by plaintiffs against the town council and the town treasurer were almost identical, we shall initially consider the reasons used by the trial justices who granted these two motions to dismiss. In granting the town council's motion, the trial justice reasoned that, based upon Stepping Stone Enterprises, Ltd. v. Andrews, 531 F.2d 1 (1st Cir. 1976), plaintiffs were precluded by the doctrine of res judicata from complaining that the statute and the ordinance were unconstitutional. He concluded that plaintiffs' only basis for complaint was the failure of the town council to give plaintiffs notice of the July 9, 1975, hearing. The trial justice resolved this matter by finding that because plaintiffs were not a party of record before the town council, they were not entitled to notice. In granting the town treasurer's motion to dismiss, the trial justice initially noted that the town treasurer did not have the power to grant or deny public entertainment licenses. He opined that plaintiffs acted unreasonably when they concluded that the application for the festival was accepted because the town treasurer negotiated the license-fee check. The trial justice thus concluded that plaintiffs failed to state a claim against the town treasurer, and he granted the motion to dismiss the complaint.
We have stated on numerous occasions that the sole function of a Super.R. Civ.P. 12(b)(6) motion to dismiss a complaint is to test the sufficiency of the complaint. Dutson v. Nationwide Mutual Insurance Co., R.I., 383 A.2d 597, 599 (1978). It is well established that such a motion should not be granted unless it appears beyond a reasonable doubt that the plaintiffs would not be entitled to any relief no matter what facts could be proved in support of their claim. Id. In drawing his conclusions, the trial justice is bound to resolve all doubts in the plaintiffs' favor *836 and to accept the allegations in their complaint as true. Noble Co. v. Mack Financial Corp., 107 R.I. 12, 14, 264 A.2d 325, 327 (1970). In order to determine whether the trial court erred in finding that plaintiffs' complaints against the town council and the town treasurer failed to establish any factual basis upon which recovery could be based, we have examined the two complaints.
In their complaints against the town council and the town treasurer, plaintiffs alleged, inter alia, that the town council failed to apply properly the legislative standards established in the statute and ordinance to the license application for the festival. Although plaintiffs did not submit the license application to the town council, plaintiffs did make an allegation in their complaints that they authorized Stepping Stone to submit the license application on their behalf. When this assertion is read together with the remaining allegations in the complaint, with all doubts resolved in plaintiffs' favor, the complaint establishes a limited principal-agent relationship between plaintiffs and Stepping Stone for the purpose of submitting the license application. As a result of this relationship, plaintiffs, as principals, would thereby possess the requisite standing to maintain the actions for the alleged illegal conduct of the town council. See Weatherby v. Weatherby Lumber Co., 94 Idaho 504, 507, 492 P.2d 43, 46 (1972). The trial court erred, therefore, when it granted the town council's and the town treasurer's motions to dismiss the two complaints pursuant to Super.R.Civ.P. 12(b)(6).
We next consider the trial court's granting of the town council's motion to dismiss Stepping Stone's cross-claim. In granting the town council's motion, the trial justice ruled that in order for Stepping Stone to recover in the cross-claim, it would have to show that the town council acted in an arbitrary or capricious manner in denying the license. The trial justice concluded that in granting the town council's earlier motion to dismiss, the Superior Court justice found that the town council had not acted in an illegal manner. He therefore concluded that these findings precluded the town council from being held liable under the cross-claim and granted the town council's motion to dismiss.
In reaching his decision, the trial justice clearly erred when he failed to accept the allegations in the cross-claim as true but instead went outside the complaint and made his ruling based upon what he believed to be the findings of the Superior Court justice in the earlier motion to dismiss. Our examination of the cross-claim indicates that it alleges that the town council acted in an arbitrary and capricious manner when it voted to deny Stepping Stone's license application for the festival. The allegations, if proved, would entitle Stepping Stone to relief for the wrongful refusal of the license applications. The trial justice erred, therefore, when he granted the town council's motion to dismiss the cross-claim.
The plaintiffs' and third-party defendant Stepping Stone's appeals are sustained, the judgments appealed from are reversed, and the cases are remanded to the Superior Court for further proceedings consistent with this opinion.
NOTES
[1]  Hereinafter, Stepping Stone Enterprises Ltd. and Henry V. Davis shall be referred to as Stepping Stone.
[2]  General Laws 1956 (1976 Reenactment) § 5-22-1, as amended by P.L.1966, ch. 260, § 1, reads as follows:

"5-22-1 Town regulatory powers.The town councils and city councils may license, regulate and in those certain cases specifically set forth in § 55-22-5 may prohibit and suppress theatrical performances, rope and wire dancing and all other shows and performances in their respective towns, conforming to law."
General Laws 1956 (1976 Reenactment) § 5-22-2, as amended by P.L.1938, ch. 333, § 17, reads:
"5-22-2 Town license for exhibitions. They may grant a license, for a term not exceeding one (1) year, under such restrictions and regulations as they shall think proper, to the owner of any house, room or hall in the town, for the purpose of permitting exhibitions therein, which license shall be revocable at the pleasure of said town council."
General Laws 1956 (1976 Reenactment) § 5-22-4, as amended by P.L.1938, ch. 362, § 1, reads:
"5-22-4 Town license required.No person shall publicly or for pay or for any profit or advantage to himself, exhibit or promote or take part in any theatrical performance, or rope or wire dancing or other show or performance, or conduct, engage in or promote any wrestling, boxing or sparring match or exhibition, nor shall any person for any pecuniary profit or advantage to himself, promote any public roller skating in rinks or halls, or give any dance or ball, without a license from the town council of the town in which such performance, show, exhibition, dance or ball is sought to be given."
[3]  The July 12, 1972 West Greenwich ordinance requiring applicants to obtain a license before holding public entertainment reads in pertinent part as follows:

"Be it ordained by the Town Council of the Town of West Greenwich, as follows:
"Section 1. Application:
"No person shall hold any public entertainment within the town of West Greenwich without first filing a written application for a license to do so with the Town Council of said Town. Said application shall be filed not later than seven days prior to the next regular meeting of said Town Council, provided, however, that said Town Council may waive this requirement on good cause shown by the applicant."
"Section 2. Compliance with Other Laws:
"No license shall issue by said Town Council until the applicant or applicants shall affirmatively show that the proposed entertainment if allowed, or the premises to be used therefor, if allowed, shall otherwise comply with all applicable Federal, State and local laws relative to the health, safety and welfare of the public, including, but not limited to: Traffic, zoning, parking, fire protection and the like."
[4]  Although neither the statute nor the ordinance requires a license fee, the parties are apparently referring to Stepping Stone's attempt to obtain a retail alcoholic beverage license pursuant to chapter 7 of the General Laws, which does require license fees.
[5]  General Laws 1956 (1970 Reenactment) § 45-15-5 reads as follows:

"Every person who shall have any money due him from any town or city, or any claim or demand against any town or city, for any matter, cause or thing whatsoever, shall take the following method to obtain the same, to wit: Such person shall present to the town council of the town, or to the city council of the city, a particular account of his claim, debt, damages or demand, and how incurred or contracted; which being done, in case just and due satisfaction is not made him by the town or city treasurer or such town or city within forty (40) days after the presentment of such claim, debt, damages or demand aforesaid, such person may commence his action against such treasurer for the recovery of the same."
