SharePoint and K2 Blackperl
Wednesday, August 21, 2024
Friday, February 23, 2024
Powershell
Updated Stored Procedure
sqlCREATE PROCEDURE SP_GetAvailableTasksForTimesheet
@TimeSheetID INT
AS
BEGIN
-- Declare variables to hold the WeekStartDate and WeekEndDate
DECLARE @WeekStartDate DATE;
DECLARE @WeekEndDate DATE;
DECLARE @UserName NVARCHAR(100);
-- Fetch the WeekStartDate, WeekEndDate, and UserName from the TimeSheet table
SELECT
@WeekStartDate = TimeSheetStartDate,
@WeekEndDate = TimeSheetEndDate,
@UserName = EmployeeNWName
FROM
TimeSheet
WHERE
TimeSheetID = @TimeSheetID;
-- Select tasks that overlap with the given WeekStartDate and WeekEndDate
-- and are not already present in the TimeEntry table
SELECT DISTINCT
T.TaskID,
T.TaskName,
T.TaskStartDate,
T.TaskEndDate,
PR.ProjectID,
P.ProjectName
FROM Task T
JOIN ProjectResource PR ON PR.ProjectID = T.ProjectID
JOIN Project P ON PR.ProjectID = P.ProjectID
WHERE PR.EmployeeNWName = @UserName
AND P.Progress = 'Open'
AND T.Active = 1
AND (
-- Check overlap between WeekStartDate-WeekEndDate and TaskStartDate-TaskEndDate
@WeekStartDate <= ISNULL(T.TaskEndDate, '9999-12-31') AND @WeekEndDate >= T.TaskStartDate
AND
-- Check overlap between WeekStartDate-WeekEndDate and ResourceStartDate-ResourceEndDate
@WeekStartDate <= ISNULL(PR.ResourceEndDate, '9999-12-31') AND @WeekEndDate >= PR.ResourceStartDate
AND
-- Check overlap between TaskStartDate-TaskEndDate and ResourceStartDate-ResourceEndDate
T.TaskStartDate <= ISNULL(PR.ResourceEndDate, '9999-12-31') AND ISNULL(T.TaskEndDate, '9999-12-31') >= PR.ResourceStartDate
)
AND NOT EXISTS (
SELECT 1
FROM TimeEntry TE
WHERE TE.TaskID = T.TaskID
AND TE.TimeSheetID = @TimeSheetID
);
END;
CREATE PROCEDURE SP_GetAvailableTasksForTimesheet
@TimeSheetID INT
AS
BEGIN
-- Declare variables to hold the WeekStartDate and WeekEndDate
DECLARE @WeekStartDate DATE;
DECLARE @WeekEndDate DATE;
DECLARE @UserName NVARCHAR(100);
-- Fetch the WeekStartDate, WeekEndDate, and UserName from the TimeSheet table
SELECT
@WeekStartDate = TimeSheetStartDate,
@WeekEndDate = TimeSheetEndDate,
@UserName = EmployeeNWName
FROM
TimeSheet
WHERE
TimeSheetID = @TimeSheetID;
-- Select tasks that overlap with the given WeekStartDate and WeekEndDate
-- and are not already present in the TimeEntry table
SELECT DISTINCT
T.TaskID,
T.TaskName,
T.TaskStartDate,
T.TaskEndDate,
PR.ProjectID,
P.ProjectName
FROM Task T
JOIN ProjectResource PR ON PR.ProjectID = T.ProjectID
JOIN Project P ON PR.ProjectID = P.ProjectID
WHERE PR.EmployeeNWName = @UserName
AND P.Progress = 'Open'
AND T.Active = 1
AND (
-- Check overlap between WeekStartDate-WeekEndDate and TaskStartDate-TaskEndDate
@WeekStartDate <= ISNULL(T.TaskEndDate, '9999-12-31') AND @WeekEndDate >= T.TaskStartDate
AND
-- Check overlap between WeekStartDate-WeekEndDate and ResourceStartDate-ResourceEndDate
@WeekStartDate <= ISNULL(PR.ResourceEndDate, '9999-12-31') AND @WeekEndDate >= PR.ResourceStartDate
AND
-- Check overlap between TaskStartDate-TaskEndDate and ResourceStartDate-ResourceEndDate
T.TaskStartDate <= ISNULL(PR.ResourceEndDate, '9999-12-31') AND ISNULL(T.TaskEndDate, '9999-12-31') >= PR.ResourceStartDate
)
AND NOT EXISTS (
SELECT 1
FROM TimeEntry TE
WHERE TE.TaskID = T.TaskID
AND TE.TimeSheetID = @TimeSheetID
);
END;
SharePoint Server Subscription Edition (SE) supports the following versions of Windows Server:
- Windows Server 2019
- Windows Server 2022
Sharepoint server upgrade
SharePoint upgrades from SharePoint 2019 to SharePoint Server Subscription Edition does not support In place upgrade.
SQL Server
SharePoint Server Subscription Edition (SE) supports the following versions of SQL Server:
- SQL Server 2019 (Standard or Enterprise edition)
- SQL Server 2022 (Standard or Enterprise edition)
If we already have SQL Server 2019 in place it will streamline the upgrade process, as it's supported by both SharePoint versions.
Updated Stored Procedure
Here is how the updated SP_GetMissingTimesheets
stored procedure might look, incorporating the overlap logic:
sqlALTER PROCEDURE [TT].[SP_GetMissingTimesheets]
AS
BEGIN
DECLARE @Today DATE = GETDATE();
DECLARE @WeekStartDate DATE;
DECLARE @WeekEndDate DATE;
-- Clear previous entries in the MissingTimesheets table (optional)
-- DELETE FROM MissingTimesheets WHERE Created < DATEADD(WEEK, -5, GETDATE());
-- Loop through the past 5 weeks
DECLARE @WeekOffset INT = 1;
-- Truncate the MissingTimesheets table to clear any existing data
TRUNCATE TABLE MissingTimesheets;
WHILE @WeekOffset < 5
BEGIN
-- Calculate the start and end dates of the week using the function
SELECT @WeekStartDate = WeekStartDate, @WeekEndDate = WeekEndDate
FROM Fun_GetWeekStartEndDate(@Today, -@WeekOffset);
-- Insert missing timesheets into the permanent table, excluding records where date ranges do not overlap
INSERT INTO MissingTimesheets (EmployeeEmail, WeekStartDate, WeekEndDate)
SELECT DISTINCT E.EmployeeEmail, @WeekStartDate, @WeekEndDate
FROM Resource E
LEFT JOIN TimeSheet TS ON E.EmployeeNWName = TS.EmployeeNWName
AND TS.TimeSheetStartDate = @WeekStartDate
AND TS.TimeSheetEndDate = @WeekEndDate
WHERE (TS.TimeSheetID IS NULL OR TS.TimeSheetStatus IN ('Not Started', 'Saved', 'Returned'))
AND EXISTS (
SELECT 1
FROM Task T
JOIN ProjectResource PR ON PR.ProjectID = T.ProjectID
WHERE PR.EmployeeNWName = E.EmployeeNWName
AND (
-- Check overlap between WeekStartDate-WeekEndDate and TaskStartDate-TaskEndDate
(@WeekStartDate <= ISNULL(T.TaskEndDate, '9999-12-31') AND @WeekEndDate >= T.TaskStartDate)
AND
-- Check overlap between WeekStartDate-WeekEndDate and ResourceStartDate-ResourceEndDate
(@WeekStartDate <= ISNULL(PR.ResourceEndDate, '9999-12-31') AND @WeekEndDate >= PR.ResourceStartDate)
AND
-- Check overlap between TaskStartDate-TaskEndDate and ResourceStartDate-ResourceEndDate
(T.TaskStartDate <= ISNULL(PR.ResourceEndDate, '9999-12-31') AND ISNULL(T.TaskEndDate, '9999-12-31') >= PR.ResourceStartDate)
)
);
SET @WeekOffset = @WeekOffset + 1;
END
-- Select and format the missing timesheets
SELECT
ROW_NUMBER() OVER (ORDER BY E.EmployeeEmail) AS MissingTimesheetID,
E.EmployeeNWName,
E.EmployeeEmail,
E.EmployeeDisplayName,
'<ul>' + STRING_AGG('<li>' + CONVERT(VARCHAR, M.WeekStartDate, 101) + ' - ' + CONVERT(VARCHAR, M.WeekEndDate, 101) + '</li>', '') + '</ul>' AS MissingWeeks
FROM
MissingTimesheets M
JOIN Resource E ON M.EmployeeEmail = E.EmployeeEmail
WHERE
M.Created >= DATEADD(WEEK, -5, @Today)
GROUP BY
E.EmployeeNWName,
E.EmployeeEmail,
E.EmployeeDisplayName;
END;
Stored Procedure
sqlCREATE PROCEDURE SP_AddEmployeeToGeneralProjects
@EmployeeNWName NVARCHAR(100)
AS
BEGIN
-- Declare a variable to hold the ProjectID
DECLARE @ProjectID INT;
-- Cursor to iterate through projects with Portfolio 'General'
DECLARE ProjectCursor CURSOR FOR
SELECT ProjectID
FROM Project
WHERE PortfolioID = (SELECT PortfolioID FROM Portfolio WHERE PortfolioName = 'General');
OPEN ProjectCursor;
FETCH NEXT FROM ProjectCursor INTO @ProjectID;
WHILE @@FETCH_STATUS = 0
BEGIN
-- Check if EmployeeNWName is already in the ProjectResource table for the current ProjectID
IF NOT EXISTS (
SELECT 1
FROM ProjectResource
WHERE ProjectID = @ProjectID
AND EmployeeNWName = @EmployeeNWName
)
BEGIN
-- Insert the EmployeeNWName into the ProjectResource table
INSERT INTO ProjectResource (ProjectID, EmployeeNWName, ResourceStartDate, Active)
VALUES (@ProjectID, @EmployeeNWName, GETDATE(), 1); -- Assuming Active and StartDate
END
FETCH NEXT FROM ProjectCursor INTO @ProjectID;
END
CLOSE ProjectCursor;
DEALLOCATE ProjectCursor;
END;
CREATE PROCEDURE SP_AddEmployeeToGeneralProjects
@EmployeeNWName NVARCHAR(100)
AS
BEGIN
-- Declare a variable to hold the ProjectID
DECLARE @ProjectID INT;
-- Cursor to iterate through projects with Portfolio 'General'
DECLARE ProjectCursor CURSOR FOR
SELECT ProjectID
FROM Project
WHERE PortfolioID = (SELECT PortfolioID FROM Portfolio WHERE PortfolioName = 'General');
OPEN ProjectCursor;
FETCH NEXT FROM ProjectCursor INTO @ProjectID;
WHILE @@FETCH_STATUS = 0
BEGIN
-- Check if EmployeeNWName is already in the ProjectResource table for the current ProjectID
IF NOT EXISTS (
SELECT 1
FROM ProjectResource
WHERE ProjectID = @ProjectID
AND EmployeeNWName = @EmployeeNWName
)
BEGIN
-- Insert the EmployeeNWName into the ProjectResource table
INSERT INTO ProjectResource (ProjectID, EmployeeNWName, ResourceStartDate, Active)
VALUES (@ProjectID, @EmployeeNWName, GETDATE(), 1); -- Assuming Active and StartDate
END
FETCH NEXT FROM ProjectCursor INTO @ProjectID;
END
CLOSE ProjectCursor;
DEALLOCATE ProjectCursor;
END;
Updated Stored Procedure
sqlALTER PROCEDURE [TT].[SP_GetMissingTimesheets]
AS
BEGIN
DECLARE @Today DATE = GETDATE();
DECLARE @WeekStartDate DATE;
DECLARE @WeekEndDate DATE;
-- Clear previous entries in the MissingTimesheets table (optional)
-- DELETE FROM MissingTimesheets WHERE Created < DATEADD(WEEK, -5, GETDATE());
-- Loop through the past 5 weeks
DECLARE @WeekOffset INT = 1;
-- Truncate the MissingTimesheets table to clear any existing data
TRUNCATE TABLE MissingTimesheets;
WHILE @WeekOffset < 5
BEGIN
-- Calculate the start and end dates of the week using the function
SELECT @WeekStartDate = WeekStartDate, @WeekEndDate = WeekEndDate
FROM Fun_GetWeekStartEndDate(@Today, -@WeekOffset);
-- Insert missing timesheets into the permanent table
INSERT INTO MissingTimesheets (EmployeeEmail, WeekStartDate, WeekEndDate)
SELECT E.EmployeeEmail, @WeekStartDate, @WeekEndDate
FROM Resource E
LEFT JOIN TimeSheet TS
ON E.EmployeeNWName = TS.EmployeeNWName
AND TS.TimeSheetStartDate = @WeekStartDate
AND TS.TimeSheetEndDate = @WeekEndDate
WHERE TS.TimeSheetID IS NULL
OR TS.TimeSheetStatus IN ('Not Started', 'Saved', 'Returned');
SET @WeekOffset = @WeekOffset + 1;
END
-- Select and format the missing timesheets
SELECT
ROW_NUMBER() OVER (ORDER BY EmployeeEmail) AS MissingTimesheetID,
E.EmployeeNWName,
E.EmployeeEmail,
E.EmployeeDisplayName,
'<ul>' + STRING_AGG('<li>' + CONVERT(VARCHAR, M.WeekStartDate, 101) + ' - ' + CONVERT(VARCHAR, M.WeekEndDate, 101) + '</li>', '') + '</ul>' AS MissingWeeks
FROM
MissingTimesheets M
JOIN Resource E ON M.EmployeeEmail = E.EmployeeEmail
WHERE
M.Created >= DATEADD(WEEK, -5, @Today)
GROUP BY
E.EmployeeNWName,
E.EmployeeEmail,
E.EmployeeDisplayName;
END;
ALTER PROCEDURE [TT].[SP_GetMissingTimesheets]
AS
BEGIN
DECLARE @Today DATE = GETDATE();
DECLARE @WeekStartDate DATE;
DECLARE @WeekEndDate DATE;
-- Clear previous entries in the MissingTimesheets table (optional)
-- DELETE FROM MissingTimesheets WHERE Created < DATEADD(WEEK, -5, GETDATE());
-- Loop through the past 5 weeks
DECLARE @WeekOffset INT = 1;
-- Truncate the MissingTimesheets table to clear any existing data
TRUNCATE TABLE MissingTimesheets;
WHILE @WeekOffset < 5
BEGIN
-- Calculate the start and end dates of the week using the function
SELECT @WeekStartDate = WeekStartDate, @WeekEndDate = WeekEndDate
FROM Fun_GetWeekStartEndDate(@Today, -@WeekOffset);
-- Insert missing timesheets into the permanent table
INSERT INTO MissingTimesheets (EmployeeEmail, WeekStartDate, WeekEndDate)
SELECT E.EmployeeEmail, @WeekStartDate, @WeekEndDate
FROM Resource E
LEFT JOIN TimeSheet TS
ON E.EmployeeNWName = TS.EmployeeNWName
AND TS.TimeSheetStartDate = @WeekStartDate
AND TS.TimeSheetEndDate = @WeekEndDate
WHERE TS.TimeSheetID IS NULL
OR TS.TimeSheetStatus IN ('Not Started', 'Saved', 'Returned');
SET @WeekOffset = @WeekOffset + 1;
END
-- Select and format the missing timesheets
SELECT
ROW_NUMBER() OVER (ORDER BY EmployeeEmail) AS MissingTimesheetID,
E.EmployeeNWName,
E.EmployeeEmail,
E.EmployeeDisplayName,
'<ul>' + STRING_AGG('<li>' + CONVERT(VARCHAR, M.WeekStartDate, 101) + ' - ' + CONVERT(VARCHAR, M.WeekEndDate, 101) + '</li>', '') + '</ul>' AS MissingWeeks
FROM
MissingTimesheets M
JOIN Resource E ON M.EmployeeEmail = E.EmployeeEmail
WHERE
M.Created >= DATEADD(WEEK, -5, @Today)
GROUP BY
E.EmployeeNWName,
E.EmployeeEmail,
E.EmployeeDisplayName;
END;
sqlCREATE PROCEDURE SP_FindMissingTimesheets
AS
BEGIN
DECLARE @Today DATE = GETDATE();
DECLARE @WeekStartDate DATE;
DECLARE @WeekEndDate DATE;
-- Clear previous entries in the MissingTimesheets table (optional)
-- DELETE FROM MissingTimesheets WHERE Created < DATEADD(WEEK, -5, GETDATE());
-- Loop through the past 5 weeks
DECLARE @WeekOffset INT = 0;
WHILE @WeekOffset < 5
BEGIN
-- Calculate the start and end dates of the week using the function
SELECT @WeekStartDate = WeekStartDate, @WeekEndDate = WeekEndDate
FROM dbo.Fun_GetWeekStartEndDate(@Today, -@WeekOffset);
-- Insert missing timesheets into the permanent table
INSERT INTO MissingTimesheets (EmployeeEmail, WeekStartDate, WeekEndDate)
SELECT E.EmployeeEmail, @WeekStartDate, @WeekEndDate
FROM Resource E
LEFT JOIN TimeSheet TS
ON E.EmployeeNWName = TS.EmployeeNWName
AND TS.TimeSheetStartDate = @WeekStartDate
AND TS.TimeSheetEndDate = @WeekEndDate
WHERE TS.TimeSheetID IS NULL
OR TS.Status IN ('Not Started', 'Saved');
SET @WeekOffset = @WeekOffset + 1;
END
-- Select and format the missing timesheets
SELECT
ROW_NUMBER() OVER (ORDER BY EmployeeEmail) AS ID,
EmployeeEmail,
'<ul>' + STRING_AGG('<li>' + CONVERT(VARCHAR, WeekStartDate, 101) + ' - ' + CONVERT(VARCHAR, WeekEndDate, 101) + '</li>', '') + '</ul>' AS MissingWeeks
FROM
MissingTimesheets
WHERE
Created >= DATEADD(WEEK, -5, @Today)
GROUP BY
EmployeeEmail;
END;
__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT__PRESENT
CREATE PROCEDURE SP_FindMissingTimesheets
AS
BEGIN
DECLARE @Today DATE = GETDATE();
DECLARE @WeekStartDate DATE;
DECLARE @WeekEndDate DATE;
-- Clear previous entries in the MissingTimesheets table (optional)
-- DELETE FROM MissingTimesheets WHERE Created < DATEADD(WEEK, -5, GETDATE());
-- Loop through the past 5 weeks
DECLARE @WeekOffset INT = 0;
WHILE @WeekOffset < 5
BEGIN
-- Calculate the start and end dates of the week using the function
SELECT @WeekStartDate = WeekStartDate, @WeekEndDate = WeekEndDate
FROM dbo.Fun_GetWeekStartEndDate(@Today, -@WeekOffset);
-- Insert missing timesheets into the permanent table
INSERT INTO MissingTimesheets (EmployeeEmail, WeekStartDate, WeekEndDate)
SELECT E.EmployeeEmail, @WeekStartDate, @WeekEndDate
FROM Resource E
LEFT JOIN TimeSheet TS
ON E.EmployeeNWName = TS.EmployeeNWName
AND TS.TimeSheetStartDate = @WeekStartDate
AND TS.TimeSheetEndDate = @WeekEndDate
WHERE TS.TimeSheetID IS NULL
OR TS.Status IN ('Not Started', 'Saved');
SET @WeekOffset = @WeekOffset + 1;
END
-- Select and format the missing timesheets
SELECT
ROW_NUMBER() OVER (ORDER BY EmployeeEmail) AS ID,
EmployeeEmail,
'<ul>' + STRING_AGG('<li>' + CONVERT(VARCHAR, WeekStartDate, 101) + ' - ' + CONVERT(VARCHAR, WeekEndDate, 101) + '</li>', '') + '</ul>' AS MissingWeeks
FROM
MissingTimesheets
WHERE
Created >= DATEADD(WEEK, -5, @Today)
GROUP BY
EmployeeEmail;
END;
Tuesday, February 19, 2019
Delete k2 workflow instances in bulk
K2 workflow instances bloats the database over the time period and at some point you would want to delete the old workflow instance which are completed or in error status.
Unfortunately, there is no way to delete specific instances of workflow, in other words, you could not select specific instance and delete them. However, you can delete then in a bulk.
For instance, you would want to delete old workflow instances, which are completed and occupying the significant space in database. Instances where you are not going to report anything. Or, you just want to delete then as a part of clean up activity.
You can follow below steps to do so.
- If you have 4.7 vision installed you can go to management workspace. For older version, you can follow similar steps
- Expand workflow server node.
- Go to your category to find workflow for which you want to delete workflow instances.
- Click on versions.
- Select version you want to delete.
6. Check “Delete all historical (log) data for selected versions”
Be careful though, “Delete all historical (log) data for selected versions” option deletes all workflow instances including active as well. Basically, it wipes out all the instances for that version from k2 database.
Monday, August 28, 2017
Different ways to create smartobjects from SQL service instance
I asked the question to k2 support, What is the difference between Create and generate smartobject? and they provided below answer, thought would be helpful to share.
There are three different options available to create/manage SmartObject from a SQL Service Instance via SmartObject Service Tester tool:
a. From service instance > Create SmartObjects
- manages the creation and updates of all SQL SmartObjects of the service instance as well as SmartObject's category as a set (no control over displayname and guid)
- allows for the appending of a string to all of the SmartObject system name (no control over the overall displayname, systemname, guid)
- can be used to update all SmartObject as a set if there are changes to the database objects schema(tables, views, sprocs)
- displayname, systemname and guid will remain the same (if targeting the same set of SmartObject)
b. From service instance > Generate SmartObjects
- manages the creation and updates of all SQL SmartObjects of the service instance as a set (no control over displayname, systemname, category, guid)
- can be used to update all SmartObject as a set if there are changes to the database objects schema (tables, views, sprocs)
- displayname, systemname and guid will remain the same
c. From Service Object > Create SmartObject (singular)
- allows for managing of the SystemName/DisplayName, GUID, and category SmartObject is created in
- can be used to regenerate/update the existing SmartObject by targeting the 'SystemName' of the SmartObject (with the 'Check Name' button) and returning the current GUID for this SmartObject (with the 'Get Existing Guid' button) before publishing it again
** if not returning the existing name and GUID, a new SmartObject with different value will be created
* all three options mainly used if there are NO customization with the SmartObject and the default generated functionality is desired; as regenerating the SmartObject with the same SystemName and GUID will remove any customization previously done; if SmartObject was customized, manually changes to these objects in the designer that they were designed in (K2 Designer, K2 Studio, K2 for Visual Studio) will preserve the customization.
Friday, July 22, 2016
K2 Interview Questions: Workspace, Part 1 (Intermidiate)
0 = Available
|
The item has not been opened yet
|
1 = Open
|
The item was previously opened by the current user
|
2 = Allocated
|
The item was opened by another user
|
3 = Sleep
|
The item was set to sleep for a specified amount of time
|
4 = Completed
|
The item was already completed by this or another user
|
Wednesday, July 13, 2016
K2 Interview Questions: Workflows, Part 2 (Advance)
1. Sometimes the error is because of network issues, some connection problem or no proper inputs. If you just go to the error profile in the workspace and retry the error it fixes the problem.
2. If above approach does not resolve the error you can use the K2 Process Management tool in Visual Studio.
As shown in the figure below. you can select process clicking View->K2 Process Management tool in visual studio. Select the process in error and open the process and fix the error.
After fixing the error, go back to the k2 process management and click redeploy the process.
You can provide the label and deploy the process. It will fix that instance of the process. Then you can fix the processes with similar error hitting the retry button and selecting the fixed version of the process.
How do you debug the process if the Visual studio is not installed on the K2 box?
http://spandk2.blogspot.com/2012/11/how-to-debug-k2-process.html
Thursday, July 7, 2016
K2 Interview Questions: Workflows, Part 1 (Advance)
- The IPC (The Inter Process Communication) event wizard is normally used to implement a Parent-Child workflow or sub-workflow requirement.
- Also it is useful when you want to split a larger workflow into sub-processes, when you have processes that are generically re-usable, or when you want to start multiple instances of a child workflow from a parent workflow.
- You can use it to set Folio, Originator, and data field values for a Child workflow as part of the wizard.
- There are two options while configuring the call to the child process
Synchronous: Parent workflow waits for Child workflow to complete.
Asynchronous: 'fire-and-forget' style, in which the Parent workflow continues immediately after starting the Child workflow. - Use advanced destination rules (Plan per Slot, No Destinations) to allow one Parent workflow to start multiple Children
Plan Just Once :
- This default option. K2 will execute the events in the Activity prior to the Client Event just one time, regardless of how many destinations or slots have been defined. The events after the Client event will be executed each time a user completes a task. This is the default behavior for Activities.
- This option is most appropriate for high-volume scenarios where a large group gets the task but only one user will ever need to open the task.
- When this option is selected, there is only one activity instance, which is shared amongst all destinations for the task.
Plan per destination: - This approach is most often used when more than one person will open the task, and you need to capture input from each user into the same activity datafields.
- K2 creates separate copies of the Activity Instance for each destination
Plan per destination – All at Once : - K2 will execute the events in the activity for each destination in the activity in parallel fashion. Each event in the activity is repeated for each destination, and then K2 moves on to the next event in the activity and repeats that event for each destination.
- This planning option specifies that all destinations will get the task at the same time (Parallel). Any one of the destination users can open the task and complete it. If any of the outcomes are true for the activity, the other copies of the task are removed from the other user’s task lists, and K2 completes the activity.
- Plan per destination – One at a Time : K2 will execute the events in the activity for each destination in the activity in serial fashion. K2 starts with the first destination and executes the Events in the activity once for that destination. If the Outcome is false, K2 moves on to the second destination and then executes the events in sequence for the second destination. This is repeated for each destination in the activity until the Outcome succeeds or no more destinations are available.
Plan per slot – (no destinations) : - This setting is normally used for activities that only contain server events when you want to repeat the events in the activity N-number of times for each slot in the activity.
- It is similar to the Plan Per Destination – All at Once setting except that K2 does not use the Destinations to determine how many times to execute the events but rather the number of slots specified on the next page of the Destination Rule wizard.
3. If you need to call the same assembly/Service multiple times, it is recommended to expose that assembly/Service as a SmartObject.
- By using one of the available EndPoint Service Brokers,
- By writing a custom Broker that exposes the necessary functions. This will allow you (and other designers) to call the methods in the Service/Assembly easily without having to write code.
What is Asynchronous server event?
All K2 Interview Questions