1998–2006: Television series and theatre work
Sorkin conceived the idea to write about the behind-the-scenes happenings on a sports show while residing at the Four Seasons Hotel in Los Angeles writing the screenplay for The American President. He would work late, with the television tuned into ESPN, watching continuous replays of SportsCenter. The show inspired him to try to write a feature film about a sports show but he was unable to structure the story for film, so instead he turned his idea into a television comedy series. Sports Night was produced by Disney and debuted on the ABC network in fall of 1998.
Sorkin fought with ABC during the first season over the use of a laugh track and a live studio audience. The laugh track was widely decried by critics as jarring, with Joyce Millman of Salon magazine describing it as "the most unconvincing laugh track you've ever heard". Sorkin commented that: "Once you do shoot in front of a live audience, you have no choice but to use the laugh track. Oftentimes [enhancing the laughs] is the right thing to do. Sometimes you do need a cymbal crash. Other times, it alienates me." The laugh track was gradually dialed down and was removed by the end of the first season. Sorkin was triumphant in the second season when ABC agreed to his demands, unburdening the crew of the difficulties of staging a scene for a live audience and leaving the cast with more time to rehearse. Although Sports Night was critically acclaimed, ABC canceled the show after two seasons due to low ratings. Sorkin entertained offers to continue the show on other television channels, but declined all the offers because they were dependent on his involvement and he was already working on The West Wing.
Sorkin conceived the political drama The West Wing in 1997 when he went unprepared to a lunch with producer John Wells; in a panic he pitched to Wells a series centered on the senior staff of the White House, using leftover ideas from his script for The American President. He told Wells about his visits to the White House while doing research for The American President, and they found themselves discussing public service and the passion of the people who serve. Wells took the concept and pitched it to NBC, but was told to wait due to the Clinton–Lewinsky scandal. There was a concern that television audiences would not be able to take a series about the White House seriously. A year later, other networks started showing interest in The West Wing. NBC decided to give the project the green-light despite their previous reluctance. The pilot debuted in the fall of 1999 and was produced by Warner Bros. Television.
The West Wing garnered nine Primetime Emmy Awards for its debut season, making the series a record holder for most Emmys won by a series in a single season at the time. Following the awards ceremony, there was a dispute about the acceptance speech for Outstanding Writing for a Drama Series. The West Wing episode "In Excelsis Deo" won, which was awarded to Sorkin and Rick Cleveland, but The New York Times reported that Sorkin ushered Cleveland off the stage before he could say a few words. The story behind "In Excelsis Deo" is based on Cleveland's father, a Korean War veteran who spent the last years of his life on the street, as Cleveland explained in an essay titled "I Was the Dumb Looking Guy with the Wire-Rimmed Glasses". Sorkin and Cleveland continued their dispute in a public web forum at Mighty Big TV in which Sorkin explained that he gives his writers "Story By" credit on a rotating basis "by way of a gratuity" and that he had thrown out Cleveland's script and started from scratch. Sorkin eventually apologized to Cleveland. Cleveland and Sorkin also won the Writers Guild of America Award for Television: Episodic Drama at the 53rd Writer Guild of America Awards for "In Excelsis Deo".
In 2001, after completing the second season of The West Wing, Sorkin had a drug relapse, and was arrested at Hollywood Burbank Airport for possession of hallucinogenic mushrooms, marijuana, and crack cocaine. He was ordered by a court to attend a drug diversion program. There was huge media interest but he did make a successful recovery. In 2002, Sorkin criticized NBC News anchor Tom Brokaw's television special about a day in the life of a president, "The Bush White House: Inside the Real West Wing", comparing it to the act of sending a valentine to President George W. Bush instead of real news reporting. The West Wing aired on the same network, and so at the request of NBC's Entertainment President Jeff Zucker, Sorkin apologized, but later said, "there should be a difference between what NBC News does and what The West Wing TV series does."
Sorkin wrote 87 screenplays for The West Wing, which is nearly every episode during the show's first four Emmy-winning seasons. Sorkin described his role in the creative process as "not so much [that of] a showrunner or a producer. I'm really a writer." He admitted that this approach can have its drawbacks, saying "Out of 88 [West Wing] episodes that I did we were on time and on budget never, not once." In 2003, at the end of the fourth season, Sorkin and fellow executive producer Thomas Schlamme left the show due to internal conflicts at Warner Bros. Television, causing John Wells to serve as showrunner. Sorkin never watched any episodes beyond his writing tenure apart from a minute of the fifth season's first episode, describing the experience as "like watching somebody make out with my girlfriend." Sorkin later returned in the series finale for a cameo appearance as a guest at the inauguration of Matthew Santos.
In 2005, Sorkin returned to theatre; he revised his play A Few Good Men for a production at London's West End. The play opened at the Theatre Royal Haymarket in the fall of the same year and was directed by David Esbjornson, with Rob Lowe of The West Wing in the lead role. Sorkin told The Charlie Rose Show that he was developing a television series based on a late-night sketch comedy show similar to Saturday Night Live. In October 2005, a pilot script dubbed Studio 7 on the Sunset Strip, written by him and Schlamme as producer, started circulating in Hollywood and online. In that same month, NBC bought the rights from Warner Bros. Television to air the series on their network for a near-record license fee after a bidding war with CBS. The show's name was later changed to Studio 60 on the Sunset Strip. Sorkin described the show as having "autobiographical elements" to it and "characters that are based on actual people" but said that it departs from those beginnings to look at the backstage maneuverings at a late night sketch comedy show.
On September 18, 2006, the pilot for Studio 60 aired on NBC, directed by Schlamme. The pilot was critically acclaimed and viewed by an audience of over 12 million, but the show experienced a significant drop in viewership mid-season. Even before the first episode aired, there was a large amount of thoughtful and scrupulous criticism in the press, as well as negative analysis from bloggers. In January 2007, Sorkin spoke out against the press for reporting heavily on the low ratings, and for using blogs and unemployed comedy writers as sources. After two months hiatus, Studio 60 resumed airing the last episodes of season one, which would be its only season.
As early as 2003, Sorkin was writing a spec script about inventor Philo Farnsworth; he was approached by producer Fred Zollo in the 1990s about adapting Elma Farnsworth's memoir into a biographical film. The following year, he completed the film screenplay, The Farnsworth Invention, which was acquired by New Line Cinema with Schlamme as director. The story is about the patent battle between Farnsworth and RCA tycoon David Sarnoff for the technology that allowed the first television transmissions in the United States. No additional details were released about the film. Shortly, Sorkin was contacted by Jocelyn Clarke of the Abbey Theatre in Dublin, requesting he write a play for them, a commission which he accepted. Sorkin decided to rewrite The Farnsworth Invention as a play. He delivered a first draft of the play to the Abbey Theatre in early 2005, and a production was planned for 2007 with La Jolla Playhouse deciding to stage a workshop production of the play in collaboration with the Abbey Theatre. In 2006, Abbey Theatre's new management quit involvement with The Farnsworth Invention. Despite this, La Jolla Playhouse carried on with Steven Spielberg serving as a producer. The production opened under La Jolla's signature Page To Stage program which allowed Sorkin and director Des McAnuff to develop the play from show-to-show according to audience reactions and feedback; the play ran from February 20, 2007, through March 25, 2007. A Broadway production followed soon after, beginning in previews, and opening on November 14, 2007; however, the play was delayed by the 2007 Broadway stagehand strike. The Farnsworth Invention eventually opened at the Music Box Theatre on December 3, 2007, and closed on March 2, 2008.