Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / Issues with Customizat...
Finance forum
Unanswered

Issues with Customization Deployment in Copilot Studio Affecting Functionality and Default Prompts

Posted on by 24
Hi,
I am currently facing an issue after adding my customization in Copilot Studio through Microsoft D365 F&O. I have added code that returns unposted journals by a specific date range (which will be provided by the user through Copilot Sidecar in the D365 F&O environment). After deploying my code, I am facing an issue where, upon opening the Copilot Sidecar, an error pops up.

Moreover, my previous customizations that worked fine before deploying are also not working. Additionally, the default prompts like "What can Copilot do?" sometimes respond with "Sorry, I don't know that one yet, but I'm always learning." Other times, they only respond after refreshing 4 to 5 times.

Is there any way to debug this via Visual Studio or through Copilot Studio?

  • HH-28061501-0 Profile Picture
    HH-28061501-0 24 on at
    Issues with Customization Deployment in Copilot Studio Affecting Functionality and Default Prompts

    André Arnaud, I checked my code by adding it in a runnable class and then retrieving data via info. It is giving me the correct answer. However, when I deployed it and opened Copilot Sidecar, this error popped up, and the screen became almost unresponsive. Since I deployed it, I can't find a way to debug this.

    Could you tell me any way to debug this issue via Copilot Studio or D365 F&O? Is there any way to find where logs have been saved?

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 285,407 Super User on at
    Issues with Customization Deployment in Copilot Studio Affecting Functionality and Default Prompts
    Hi,

    I have seen a similar error showing up sometimes in my sandbox but not directly when opening the sidecar. I have some Copilot X++ extensions running as well. I'm planning for another one soon where I think I also need an output parameter which I have not used in the current ones. 
    Have you tried debugging the code to see what exactly is causing this error in your environment?
  • HH-28061501-0 Profile Picture
    HH-28061501-0 24 on at
    Issues with Customization Deployment in Copilot Studio Affecting Functionality and Default Prompts
    Hi André Arnaud,
    Thanks for your reply,
    I implemented two classes and Action Menu Item in X++.

    1 CFZUnpostedJournalsByDateRange class
    2 CFZUnpostedJournal class
    3 CFZUnpostedJournalsByDateRange ActionMenuItem
    /// <summary>
    /// The CFZUnpostedJournalsByDateRange class defines a Copilot action in Dynamics 365 Finance and Operations (D365 F&O) that
    /// retrieves unposted journal data within a specified date range.
    /// It allows users to view unposted journals through Copilot Studio.
    /// </summary>
    [DataContract]
    [SysCopilotChatGlobalAction]
    [SysCopilotChatActionDefinition(
        'MS.PA.RA.Copilot.CFZUnpostedJournalsByDateRange', // Identifier starting with "MS.PA"
    'Show unposted journals by specified Date Range', // Name for the copilot action
    'Present user with unposted journals for the provided date range', // Description for the Action
    menuItemActionStr(CFZUnpostedJournalsByDateRange), MenuItemType::Action)] // Secured by Menu Item
    public class CFZUnpostedJournalsByDateRange extends SysCopilotChatAction
    {
        private TransDate startDate; 
        private TransDate endDate; 
        private List  unpostedJournals;

      
        //Input parameter that is received from Copilot Studio.
        [DataMember('startDate'),
            SysCopilotChatActionInputParameter('Start date for the period.', true)]
        public TransDate parmStartDate(TransDate _startDate = startDate)
        {
            startDate = _startDate;
            return startDate;
        }
        //Input parameter that is received from Copilot Studio.
        [DataMember('endDate'),
            SysCopilotChatActionInputParameter('End date for the period.', true)]
        public TransDate parmEndDate(TransDate _endDate = endDate)
        {
            endDate = _endDate;
            return endDate;
        }
        //Output parameter, that is received by Copilot Studio once the action is executed.
        [DataMember('unpostedJournals'),
            SysCopilotChatActionOutputParameter('List of unposted journals')]
        public List parmUnpostedJournals(List _unpostedJournals = unpostedJournals)
        {
            unpostedJournals = _unpostedJournals;
            return unpostedJournals;
        }
        /// <summary>
        /// This method retrieves unposted journal data from Dynamics 365 Finance and Operations within a specified 
        /// date range and prepares it to be used as output in a Copilot action.
        /// </summary>
        /// <param name = "_actionDefinition">A parameter of type SysCopilotChatActionDefinitionAttribute, representing the definition of the action to be executed by the Copilot.</param>
        /// <param name = "_executionContext">An object parameter representing the context in which the action is being executed.</param>
        public void executeAction(SysCopilotChatActionDefinitionAttribute _actionDefinition, Object _executionContext)
        {
            LedgerJournalTable ledgerJournalTable;
            LedgerJournalTrans ledgerJournalTrans;
            // Fetch start and end dates from parameters
            TransDate fromDate = this.parmStartDate();
            TransDate toDate = this.parmEndDate();
            List  unpostedJournalsList = new List(Types::Class);
            if (fromDate && toDate)
            {
                // Fetch unposted journals within the specified date range
                while select *
                    from ledgerJournalTable
                    group by
                    ledgerJournalTable.JournalNum,
                    ledgerJournalTable.JournalName,
                    ledgerJournalTable.Name,
                    ledgerJournalTrans.TransDate
                    
                    join ledgerJournalTrans
                    where ledgerJournalTable.JournalNum == ledgerJournalTrans.JournalNum
                    && ledgerJournalTable.Posted == NoYes::No
                    && ledgerJournalTrans.TransDate >= fromDate
                    && ledgerJournalTrans.TransDate <= toDate
                    {
                    // Create a new CFZUnpostedJournal object for each record
                    CFZUnpostedJournal unpostedJournal = new CFZUnpostedJournal();
                       
                    unpostedJournal.setCFZUnpostedJournal(
                    ledgerJournalTable.JournalNum,
                    ledgerJournalTable.JournalName,
                    ledgerJournalTable.Name,
                    ledgerJournalTrans.TransDate
                    );
                    unpostedJournalsList.addEnd(unpostedJournal);
                }
                // Set the list of unposted journals as output parameter
                this.parmUnpostedJournals(unpostedJournalsList);
            }
            else
            {
                // Handle error if dates are not provided
                error('@CFZCopilotLabels:ERRProvideDateRange');
            }
        }
    }




     
    /// <summary>
    /// Represents an unposted journal entry with details such as journal number, name, description, and transaction date. 
    /// </summary>
    public class CFZUnpostedJournal
    {
        // Data members (properties)
        public str JournalNum;
       public  str JournalName;
       public str Description;
       public TransDate TransDate;
        
        public  void setCFZUnpostedJournal(str _journalNum, str _journalName, str _description, TransDate _transDate)
        {
            JournalNum = _journalNum;
            JournalName = _journalName;
            Description = _description;
            TransDate = _transDate;
        }
    }

     
  • HH-28061501-0 Profile Picture
    HH-28061501-0 24 on at
    Issues with Customization Deployment in Copilot Studio Affecting Functionality and Default Prompts
    Hi Hana Xue,
    Thanks for your reply,
    I have checked this method, but I am still facing the same issue. This did not resolve my problem.
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 285,407 Super User on at
    Issues with Customization Deployment in Copilot Studio Affecting Functionality and Default Prompts
    Hi,
     
    Can you share details of what and how you extended Copilot Studio? Did you add X++ coding as a plugin?
  • Hana Xue Profile Picture
    Hana Xue Microsoft Employee on at
    Issues with Customization Deployment in Copilot Studio Affecting Functionality and Default Prompts

Helpful resources

Quick Links

First Dynamics 365 Community Call (CRM Edition)

Don't miss the first D365 Community Call on 7/10!

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 285,407 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,446 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans