Wednesday, April 22, 2020

Show Information in Action center in D365 finance and operations instead of using infolog

class RunnableClass1
{
    /// <summary>
    /// Runs the class with the specified arguments.
    /// </summary>
    /// <param name = "_args">The specified arguments.</param>
    public static void main(Args _args)
    {
        SystemNotificationDataContract notification = new SystemNotificationDataContract();
        notification.Users().value(1, curUserId());
        notification.Title("@ApplicationPlatform:ExportToExcel_ActionCenterCompletedTitle");
        notification.RuleId('ExcelStaticExport');
        str formCaption = "Your text";
        notification.Severity(SystemNotificationSeverity::Warning);
                         notification.Message(strFmt("@ApplicationPlatform:ExportToExcel_ActionCenterCompletedMessage", formCaption));

        // Set the expiration an hour less than the expiration of the blob to avoid a condition where the blob expires before the message
        notification.ExpirationDateTime(DateTimeUtil::addHours(DateTimeUtil::utcNow(), 48));
        SystemNotificationsManager::AddNotification(notification);
    }

}

No comments:

Post a Comment

Table browser URL in D365FO

Critical Thinking icon icon by Icons8