-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathXrm.Portal.d.ts
142 lines (123 loc) · 3.57 KB
/
Xrm.Portal.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
declare namespace Xrm {
/**
* The Portal.
*/
var Portal: Portal;
}
interface Portal {
/**
* The Form.
*/
Form: Form;
/**
* The User.
*/
User: User;
}
interface Form {
/**
* Validation functions.
*/
Validation: Validation;
/**
* Returns the attribute.
* @param attributeName The attribute name.
*/
get(attributeName: string): Attribute;
}
interface Attribute {
/**
* Attachs an OnChange event to an attribute.
* @param callback The callback function.
*/
attachOnChange(callback: () => any): void;
/**
* Returns the value of an attribute.
*/
getValue(): any;
/**
* Removes an OnChange event from an attribute.
*/
removeOnChange(): void;
/**
* Disables or enables an attribute.
* @param isDisabled Disable the attribute?
*/
setDisable(isDisabled: boolean): void;
/**
* Sets the required level of an attribute with default validation and message.
* @param isRequired Make the attribute required?
*/
setRequired(isRequired: boolean): void;
/**
* Sets the required level of an attribute with custom validation and custom message.
* @param isRequired Make the attribute required?
* @param customFunction The custom validation function.
* @param customMessage The custom message.
*/
setRequired(isRequired: boolean, customFunction: () => any, customMessage: string): void;
/**
* Sets the value of an attribute.
* @param value The attribute value.
*/
setValue(value: any): void;
/**
* Sets the value of a lookup attribute.
* @param id The GUID.
* @param name The name.
* @param logicalName The entity logical name.
*/
setValue(id: string, name: string, logicalName: string): void;
/**
* Sets the visibility of an attribute.
* @param isVisible Make attribute visible?
*/
setVisible(isVisible: boolean): void;
}
interface Validation {
/**
* Performs RegEx validation.
* @param cid The attribute name.
* @param exp The RegEx expression.
* @param message The message.
* @param isRequired Attribute required?
*/
assertRegex(cid: string, exp: RegExp, message: string, isRequired?: boolean): void;
/**
* Compares two date attributes.
* @param mainid The main attribute name.
* @param subid The sub attribute name.
* @param message The message.
* @param isRequired Attribute required?
*/
compareDates(mainid: string, subid: string, message: string, isRequired?: boolean): void;
/**
* Blocks future dates from a date attribute.
* @param cid The attribute name.
* @param message The message.
* @param isRequired Attribute required?
*/
denyFutureDate(cid: string, message: string, isRequired?: boolean): void;
/**
* Blocks past dates from a date attribute.
* @param cid The attribute name.
* @param message The message.
* @param isRequired Attribute required?
*/
denyPastDate(cid: string, message: string, isRequired?: boolean): void;
/**
* Sets the valid number range of a number attribute.
* @param cid The attribute name.
* @param min The minimum value.
* @param max The maximum value.
* @param message The message.
* @param isRequired Attribute required?
*/
setNumberRange(cid: string, min: number, max: number, message: string, isRequired?: boolean): void;
}
interface User {
/**
* Returns the user.
*/
getAsync(): Promise<object>;
}