Skip to main content
Version: 1.2.0

OptionObject2015

The OptionObject2015 holds all of the content of and metadata describing the calling myAvatar form. AvatarScriptLink.NET adds several utility methods to assist with handlings these objects.

Legacy Support

Earlier versions of this object are still supported and available for use in your projects.

Properties

PropertyDescription
EntityIDThe unique Id of the selected entity. I.e., Patient, Staff, or User.
EpisodeNumberThe selected Episode Number. Will be null if the form is non-episodic.
ErrorCodeInforms myAvatar of the outcome of the ScriptLink API call.
ErrorMesgMessage to display to user with certain error codes.
FacilityThe Facility Id the user is currently working in.
FormsList of myAvatar form sections including rows and fields. See FormObject.
NamespaceNameThe Namespace the user is currently working in.
OptionIdThe unique Id of the form that sent this request.
OptionStaffIdThe Staff Id assigned to the logged on user. May be null/empty if not associated with a Practitioner.
OptionUserIdThe User Id of the logged on user.
ParentNamespaceThe Parent Namespace of the Namespace the user is currently logged into.
ServerNameThe server the request was submitted from.
SystemCodeThe System Code the user is currently working in.
SessionTokenThe SessionToken that can be used to authenticate with Avatar Web Services.

Methods

The following methods are available on the OptionObject2015 to assist with common tasks.

MethodDescription
AddFormObject(FormObject)Adds a FormObject to the OptionObject2015.
AddFormObject(string, bool)Creates a FormObject with specified FormId and adds to the OptionObject2015. The second parameter specifies whether the FormObject should be flagged as a Multiple Iteration form.
AddRowObject(string, RowObject)Adds a RowObject to the FormObject with the specified FormId.
Builder()Initializes a builder for constructing a OptionObject2015.
Clone()Clones the OptionObject2015.
DeleteRowObject(RowObject)Marks a for deletion.
DeleteRowObject(string)Marks a for deletion by specified RowId.
DisableAllFieldObjects()Sets all FieldObjects as disabled.
DisableAllFieldObjects(List of string)Sets all FieldObjects as disabled except for any listed to be excluded.
Equals(OptionObjectBase)Used to compare two OptionObject2015 to determine if they are equal. Returns bool.
Equals(object)Used to compare OptionObject2015 to an object to determine if they are equal. Returns bool.
GetCurrentRowId(string)Returns the CurrentRow RowId of the form matching the FormId.
GetFieldValue(string)Returns the first value of the field matching the Field Number.
GetFieldValue(string, string, string)Returns the value of the matching the Field Number on the specified FormObject and RowObject.
GetFieldValues(string)Returns the values of the field matching the Field Number.
GetHashCode()Overrides the GetHashCode method for a OptionObjectBase.
GetMultipleIterationStatus(string)Returns the Multiple Iteration Status of the form matching the FormId.
GetParentRowId(string)Returns the CurrentRow ParentRowId of the form matching the FormId.
Initialize()Initializes an empty OptionObject2015.
IsFieldEnabled(string)Returns whether the specified field is enabled.
IsFieldLocked(string)Returns whether the specified field is locked.
IsFieldModified(string)Returns whether the specified field is modified.
IsFieldPresent(string)Returns whether the specified field is present.
IsFieldRequired(string)Returns whether the specified field is required.
IsFormPresent(string)Returns whether the specified form is present.
IsRowMarkedForDeletion(string)Returns whether the specified RowObject is marked for deletion.
IsRowPresent(string)Returns whether the specified row is present
SetDisabledField(string)Sets the specified field as disabled.
SetDisabledFields(List of string)Sets the specified fields as disabled.
SetEnabledField(string)Sets the specified field as enabled.
SetEnabledFields(List of string)Sets the specified fields as enabled.
SetFieldValue(string, string)Sets the FieldValue of a FieldObject in the OptionObject2015 on the first form's CurrentRow.
SetFieldValue(string, string, string, string)Sets the FieldValue of a FieldObject in the OptionObject2015.
SetLockedField(string)Sets the specified field as locked.
SetLockedFields(List of string)Sets the specified fields as disabled.
SetOptionalField(string)Set the specified field as not required and enables if disabled.
SetOptionalFields(List of string)Set the specified fields as not required and enables if disabled.
SetRequiredField(string)Sets the specified field as required.
SetRequiredFields(List of string)Sets the specified fields as required.
SetUnlockedField(string)Set the specified field as unlocked.
SetUnlockedFields(List of string)Set the specified fields as unlocked.
ToHtmlString()Returns a string with all of the contents of the OptionObject2015 formatted in HTML.
ToHtmlString(bool)Returns a string with all of the contents of the OptionObject2015 formatted in HTML. Passing true will include HTML header tags.
ToJson()Returns a string with all of the contents of the OptionObject2015 formatted as JSON.
ToOptionObject()Transforms the OptionObject2015 to an OptionObject.
ToOptionObject2()Transforms the OptionObject2015 as an OptionObject2.
ToOptionObject2015()Creates a clone of the OptionObject2015.
ToReturnOptionObject()Creates an OptionObject2015 with the minimum information required to return.
ToReturnOptionObject(int, string)Creates an OptionObject2015 with the minimum information required to return plus the provided Error Code and Message.
ToXml()Returns a string with all of the contents of the OptionObject2015 formatted as XML.

Examples

The following code shows how to use OptionObject2015 to construct a web service compatible with myAvatar.

MyScriptLinkDemoService.asmx
using RarelySimple.AvatarScriptLink.Objects;
using System.Web.Services;

namespace ScriptLinkDemo.Web.Api
{
/// <summary>
/// Summary description for MyScriptLinkDemoService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class MyScriptLinkDemoService : System.Web.Services.WebService
{
[WebMethod]
public string GetVersion()
{
return "v.0.0.1";
}

[WebMethod]
public OptionObject2015 RunScript(OptionObject2015 optionObject2015, string parameters)
{
return optionObject2015.ToReturnOptionObject(ErrorCode.Alert, "Hello, World!");
}
}
}

Detailed Class Diagram