Handy SmartIcon for any Developer or Admin -- Open doc in browser

It just hit me how often a user reports a problem about a specific document. I track it down with a full-text, then I want to open it in a browser (to see what the user sees). So … I created this little formula which can be put into a SmartIcon and used in any database on any server. Quick and easy.Note 1: Substitute your domain below.

Note 2: You may or may not like the @Prompt near the bottom. Feel free to remove it.

Enjoy!

@If( @IsNewDoc;

@Return( @Prompt( [OK]; “Error: New Document”; “You cannot get a valid UNID from a document until after it has been saved.” ));

@Success);

Hdr := “http://”;

Srv := @ReplaceSubstring(@Name([CN]; @Subset(@DbName; 1));“\”;“/”);

Domain := “.mydomain.com”;

DB := “/” + @ReplaceSubstring(@Subset(@DbName;-1);“\”;“/”);

Vw := “/0/”;

UNID := @Text(@DocumentUniqueID);

Act := “?Open”;

Path:= @Trim( Hdr + Srv + Domain + DB + Vw + UNID + Act );

@Prompt( [OkCancelEdit]; “URL to current document”; “OPTIONAL: Copy the text below to your clipboard.”; Path );

@URLOpen( Path )

Subject: upgrade – Handy SmartIcon for any Developer or Admin – Open doc in browser

No one has suggested any improvements so here’s one. If anyone knows an easy way to get the domainname in @functions, rather than hardcoding it, it would be appreciated.

@If( @IsNewDoc;

@Return( @Prompt( [Ok]; “Error: New Document”; “You cannot get a valid UNID from a document until after it has been saved.” ));

@Success);

Hdr := “http://”;

Srv := @ReplaceSubstring(@Name([CN]; @Subset(@DbName; 1));“\”;“/”);

Domain := “.mydomain.com”;

DB := “/” + @ReplaceSubstring(@Subset(@DbName;-1);“\”;“/”);

Vw := “/0/”;

UNID := @Text(@DocumentUniqueID);

Act := “?Open”;

Path:= @Trim( Hdr + Srv + Domain + DB + Vw + UNID + Act );

EdPath := @Prompt([OkCancelEdit]; “URL to current document”; “OPTIONAL: Copy the text below to your clipboard.”; Path );

@URLOpen( EdPath )