Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
basic
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
xrm
basic
Commits
c1477e43
Commit
c1477e43
authored
5 years ago
by
S.Listl
Browse files
Options
Downloads
Patches
Plain Diff
Workflow servicetask parameters
parent
f5560dae
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
process/workflowServiceTaskParams_rest/process.js
+112
-12
112 additions, 12 deletions
process/workflowServiceTaskParams_rest/process.js
with
112 additions
and
12 deletions
process/workflowServiceTaskParams_rest/process.js
+
112
−
12
View file @
c1477e43
import
(
"
system.translate
"
);
import
(
"
Contact_lib
"
);
import
(
"
KeywordRegistry_basic
"
);
import
(
"
KeywordData_lib
"
);
import
(
"
system.tools
"
);
import
(
"
system.logging
"
);
import
(
"
Attribute_lib
"
);
...
...
@@ -61,13 +65,38 @@ function restget (pRequest)
});
}
function
_getUsers
(
pUseContactId
)
{
var
users
=
tools
.
getUsersByAttribute
(
tools
.
ISACTIVE
,
[
"
true
"
],
tools
.
PROFILE_FULL
);
return
users
.
map
(
function
(
user
)
{
return
{
id
:
pUseContactId
?
user
[
tools
.
PARAMS
][
tools
.
CONTACTID
]
:
user
[
tools
.
NAME
],
name
:
(
user
[
tools
.
PARAMS
][
tools
.
FIRSTNAME
]
+
"
"
+
user
[
tools
.
PARAMS
][
tools
.
LASTNAME
]).
trim
()
};
}).
sort
(
function
(
a
,
b
)
{
if
(
a
.
name
>
b
.
name
)
return
1
;
else
if
(
a
.
name
<
b
.
name
)
return
-
1
;
return
0
;
});
}
function
_getKeywords
(
pContainer
)
{
return
_mapToItemArray
(
KeywordData
.
getSimpleData
(
pContainer
));
}
var
parameterConfiguration
=
{
CreateActivity_workflowService
:
function
(
pCurrentValues
)
{
return
[
new
Parameter
(
"
activityResponsible
"
,
"
Responsible
"
,
Types
.
STRING
),
new
Parameter
(
"
activityDirection
"
,
"
Direction
"
,
Types
.
STRING
),
new
Parameter
(
"
activityCategory
"
,
"
Category
"
,
Types
.
STRING
),
new
Parameter
(
"
activityResponsible
"
,
"
Responsible
"
,
Types
.
ENUM
,
_getUsers
(
true
)
),
new
Parameter
(
"
activityDirection
"
,
"
Direction
"
,
Types
.
ENUM
,
_getKeywords
(
$KeywordRegistry
.
activityDirection
())
),
new
Parameter
(
"
activityCategory
"
,
"
Category
"
,
Types
.
ENUM
,
_getKeywords
(
$KeywordRegistry
.
activityCategory
())
),
new
Parameter
(
"
activityEntryDate
"
,
"
Entry date
"
,
Types
.
DATE
),
new
Parameter
(
"
activityContent
"
,
"
Content
"
,
Types
.
STRING
),
new
Parameter
(
"
activityTitle
"
,
"
Title
"
,
Types
.
STRING
)
...
...
@@ -78,19 +107,29 @@ function restget (pRequest)
return
[
new
Parameter
(
"
notificationCaption
"
,
"
Caption
"
,
Types
.
STRING
),
new
Parameter
(
"
notificationDescription
"
,
"
Description
"
,
Types
.
STRING
),
new
Parameter
(
"
notificationUser
"
,
"
User
"
,
Types
.
STRING
)
new
Parameter
(
"
notificationUser
"
,
"
User
"
,
Types
.
ENUM
,
_getUsers
()
)
];
},
SendEmail_workflowService
:
function
(
pCurrentValues
)
{
var
templates
=
newSelect
(
"
DOCUMENTTEMPLATEID, NAME
"
)
.
from
(
"
DOCUMENTTEMPLATE
"
)
.
where
(
"
DOCUMENTTEMPLATE.KIND
"
,
$KeywordRegistry
.
documentTemplateType
$mail
())
.
table
();
var
contacts
=
newSelect
([
"
CONTACTID
"
,
new
ContactTitleRenderer
(
Contact
.
createWithColumnPreset
(),
ContactTitleRenderer
.
OPTIONS
.
IncludeOrganisation
).
asSql
()])
.
from
(
ContactUtils
.
getFullContactString
())
.
where
(
"
CONTACT.ORGANISATION_ID
"
,
"
0
"
,
SqlBuilder
.
NOT_EQUAL
())
.
or
(
newWhere
(
"
CONTACT.ORGANISATION_ID
"
,
"
0
"
)
.
and
(
"
CONTACT.PERSON_ID is not null
"
))
.
orderBy
(
"
ORGANISATION.CUSTOMERCODE asc, ORGANISATION.NAME asc, PERSON.LASTNAME asc, PERSON.FIRSTNAME asc
"
)
.
table
();
return
[
new
Parameter
(
"
documentTemplateId
"
,
"
Document template
"
,
Types
.
ENUM
,
_mapToItemArray
(
templates
)),
new
Parameter
(
"
recipientContactId
"
,
"
Recipient
"
,
Types
.
STRING
),
new
Parameter
(
"
recipientContactId
"
,
"
Recipient
"
,
Types
.
ENUM
,
_mapToItemArray
(
contacts
)
),
new
Parameter
(
"
mailSubject
"
,
"
Subject
"
,
Types
.
STRING
),
new
Parameter
(
"
senderName
"
,
"
Sender username
"
,
Types
.
STRING
)
,
new
Parameter
(
"
senderName
"
,
"
Sender username
"
,
Types
.
STRING
)
];
},
SetAttribute_workflowService
:
function
(
pCurrentValues
)
...
...
@@ -100,10 +139,71 @@ function restget (pRequest)
// {
// return {id : attribute["#UID"], name : attribute["#CONTENTTITLE"]};
// });
return
[
new
Parameter
(
"
attributeId
"
,
"
Attribute
"
,
Types
.
STRING
),
new
Parameter
(
"
attributeName
"
,
"
Attribute name
"
,
Types
.
STRING
)
var
allAttributes
=
newSelect
(
"
AB_ATTRIBUTEID, ATTRIBUTE_PARENT_ID, ATTRIBUTE_NAME, ATTRIBUTE_TYPE, ATTRIBUTE_ACTIVE
"
)
.
from
(
"
AB_ATTRIBUTE
"
)
.
where
(
"
AB_ATTRIBUTE.ATTRIBUTE_TYPE
"
,
$AttributeTypes
.
OBJECTSELECTION
,
SqlBuilder
.
NOT_EQUAL
())
//these can't work yet
.
table
();
var
attributeNameMap
=
{};
var
attributes
=
[];
allAttributes
.
forEach
(
function
([
attributeId
,
parentId
,
attributeName
,
attributeType
,
isActive
])
{
attributeNameMap
[
attributeId
]
=
[
translate
.
text
(
attributeName
),
parentId
];
if
(
isActive
==
"
1
"
&&
attributeType
!=
$AttributeTypes
.
GROUP
&&
attributeType
!=
$AttributeTypes
.
COMBOVALUE
)
attributes
.
push
(
attributeId
);
});
attributes
=
attributes
.
map
(
function
(
attributeId
)
{
var
parentId
=
attributeId
;
var
fullName
=
""
;
//the loop will stop if an id comes up twice, because otherwise that could cause an infinite loop if the data is faulty
var
alreadyEncountered
=
{};
while
(
parentId
&&
attributeNameMap
[
parentId
]
&&
!
alreadyEncountered
[
parentId
])
{
var
[
currentName
,
currentParent
]
=
attributeNameMap
[
parentId
];
if
(
!
fullName
)
fullName
=
currentName
;
else
fullName
=
currentName
+
"
/
"
+
fullName
;
alreadyEncountered
[
parentId
]
=
true
;
parentId
=
currentParent
;
}
return
{
id
:
attributeId
,
name
:
fullName
};
});
var
parameters
=
[
new
Parameter
(
"
attributeId
"
,
"
Attribute
"
,
Types
.
ENUM
,
attributes
,
true
)
];
if
(
pCurrentValues
.
attributeId
&&
pCurrentValues
.
attributeId
.
value
)
{
var
selectedAttributeId
=
pCurrentValues
.
attributeId
.
value
;
var
attributeType
=
AttributeUtil
.
getAttributeType
(
selectedAttributeId
);
var
listValues
=
AttributeUtil
.
getPossibleListValues
(
selectedAttributeId
,
attributeType
);
var
enumValues
,
paramType
;
if
(
listValues
!=
null
)
{
enumValues
=
_mapToItemArray
(
listValues
);
paramType
=
Types
.
ENUM
;
}
else
{
paramType
=
({
"
TEXT
"
:
Types
.
STRING
,
"
LONG_TEXT
"
:
Types
.
STRING
,
"
NUMBER
"
:
Types
.
NUMBER
,
"
DATE
"
:
Types
.
DATE
})[
AttributeTypeUtil
.
getContentType
(
attributeType
)];
}
if
(
paramType
)
parameters
.
push
(
new
Parameter
(
"
attributeValue
"
,
"
Value
"
,
paramType
,
enumValues
));
}
parameters
.
push
(
new
Parameter
(
"
attributeName
"
,
"
Attribute name
"
,
Types
.
STRING
));
return
parameters
;
},
UpdateOffer_workflowService
:
function
(
pCurrentValues
)
{
...
...
@@ -112,13 +212,13 @@ function restget (pRequest)
SetSalesprojectPhase_workflowService
:
function
(
pCurrentValues
)
{
return
[
new
Parameter
(
"
salesprojectPhase
"
,
"
Phase
"
,
Types
.
STRING
)
new
Parameter
(
"
salesprojectPhase
"
,
"
Phase
"
,
Types
.
ENUM
,
_getKeywords
(
$KeywordRegistry
.
salesprojectPhase
())
)
];
},
CreateSalesprojectTouchpoint_workflowService
:
function
(
pCurrentValues
)
{
return
[
new
Parameter
(
"
touchpointType
"
,
"
Type
"
,
Types
.
STRING
),
new
Parameter
(
"
touchpointType
"
,
"
Type
"
,
Types
.
ENUM
,
_getKeywords
(
$KeywordRegistry
.
salesprojectSource
())
),
new
Parameter
(
"
touchpointInfo
"
,
"
Info
"
,
Types
.
STRING
)
];
},
...
...
@@ -132,7 +232,7 @@ function restget (pRequest)
var
parameters
;
if
(
jditoProcess
in
parameterConfiguration
&&
typeof
parameterConfiguration
[
jditoProcess
]
===
"
function
"
)
parameters
=
parameterConfiguration
[
jditoProcess
]();
parameters
=
parameterConfiguration
[
jditoProcess
](
currentValues
);
if
(
!
parameters
)
parameters
=
[];
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment