CloneUserGridConfig

You can use the CloneUserGridConfig function to remove the existing grid configuration for a target user and replace it with the grid configuration of a source user. The function copies the grid layout and view configurations from one user (source user) to another (target user). This allows the administrators to apply a predefined or template user interface setup to other users.

When to use

You can use this function:

  • When you need to replicate a users grid configuration to another user programmatically.
  • Manual setup is time-consuming and inconsistent.

When not to use

You cannot use this function when you only need to copy a subset of grid configurations. This function copies all grid config rows from the source user.

Syntax

int CloneUserGridConfig(string targetUser, string sourceUser);

Parameters

Parameter Required Type Description
targetUser string Yes

The user whose grid configuration will be removed and replaced with the source users configuration.

This value can be a literal user code or a variable such as _OBJECTKEY to refer to the current workflow object.

sourceUser string Yes The user whose grid configuration will be copied to the target user.

Return Value

The application returns an int representing the total number of grid configuration rows copied to the target user.

Returns zero (0) if the source user has no grid configuration to copy.

Implementation

The functions performs these:

  • The existing grid configuration for the target user is deleted.

    From tables like:

    • FSGRIDLAYOUTWEB
    • FSGRIDVIEWWEB
  • The grid configurations from the source user is copied.

    Inserts layout and view settings from source user into target user.

  • The result is returned.

    The number of rows copied (e.g., 366 in your QA test)

Side effects

The existing grid configuration rows for the target user are permanently removed before copying.

Prerequisites

  • Both the target user and source user must be valid users in the system.
  • If the source user has no grid configuration, the target users existing configuration is still removed and a value zero (0) is returned.

Examples

Example 1
Full action script using CloneUserGridConfig
using System;
using Formation.Shared.Defs;
using System.Data;
using System.Collections;
using System.Xml;

class ActionScript : FcProcFuncSetEventWF
{
    public long wf_start()
    {
        MessageList("Start Copy");

        // Clone grid config from ADMIN to the current workflow object (target user)
        int val = CloneUserGridConfig(_OBJECTKEY, "ADMIN");

        // Log the number of rows copied
        MessageList("Result: ", val.ToString());

        return 111;
    }
}
Description
The grid configuration from the ADMIN user to the current workflow user is cloned and displays the number of rows copied using MessageList.