Showing posts with label DYNAMICS. Show all posts
Showing posts with label DYNAMICS. Show all posts

Using Flow to Integrate Dynamics CRM and SharePoint

A manufacturing company's sales staff visits a client, they are required to fill out a “Visit Report” so that others in the company can review their information. The client wanted to store these reports in SharePoint because Dynamics 365 licenses are more expensive than the general Office 365 licenses, which SharePoint is a part of.

Visit Reports were created as an entity related to accounts in the Dynamics 365 system.

Steps performed:

  1. Set up Document Management sync between Dynamics 365 and SharePoint Online.
  2. Create a content type in SharePoint and associate a Word template with it.
  3. Go into Microsoft Flow and create a blank flow.
  4. Add a “trigger” from Dynamics 365 which will launch the flow whenever a record is created or updated in Visit Reports.
  5. Add an “action” from Dynamics 365 to get a record from the Account entity.
  6. Select the correct organization name (i.e. your company’s main tenant; ours is “MRS Company Limited”), select “Accounts”, and for the Item Identifier, we chose “Customer” from the list of dynamic content.

  7. Add an action to “Get file content” from SharePoint library Visit Report. This will be the blank template for Visit Report.
  8. The flow will prompt you for the site address and file identifier. Under site address, select/enter the URL for the SharePoint site. For File Identifier, select the template from the library location.
  9. Add another action step to create the file in the SharePoint library “Visit Reports”.
  10. Under site address, enter the URL for the document’s destination location in SharePoint. For the folder path, select the exact library. In this case, it is “/sti_visitreports”. For File Name, select Account Name from the Get Record step (see above) and Visit Date from the date the location was created/updated. For File Content, select File Content from the Get File Content step. See the screenshot below:
  11. The final step is to add an action to update file properties. From here, select the URL and SharePoint document library, and then enter the ItemID from the Create File step. At this point, you can add any metadata that is required via the dynamic content tab.
  12. Click save and start testing!

Changing the posting type on an account after you close the year in General Ledger for Microsoft Dynamics GP

Microsoft Dynamics GP 2013 R2 (12.00.1745) and higher versions:

New functionality was added that will allow you to reopen a year yourself that was already closed successfully. With this new functionality, you can reopen the GL year, change the posting type on the GL Account setup, and simply reclose the GL Year again so the account closes properly. To do this, follow these steps:

1. Have all users exit all companies, and make a current backup of the company database.

Note: If any other users are logged into any company in this Microsoft Dynamics GP installation, you will get a message "You cannot reverse the historical year because other users are logged in to the system." All users need to be logged out of all companies. 

2. Click on Microsoft Dynamics GP, point to Tools, point to Routines, point to Financial and click Year-End Closing.

3. In the Year-End Closing window, click on the Reverse Historical Year button at the bottom.

4. Click Process to reopen the last closed historical year as shown in the Year to Open field.  

5. Click Continue to verify that you have made a backup of the company database. If not, click Cancel and make a backup of the company database before proceeding.

Note: This process will physically move all the historical data from the GL history table to the GL Open Transaction table, and reverse all the Beginning Balance Entries that we brought forward. This process will reopen the GL year as if it was never closed in the first place.

6. Once the year is reopened, the next historical year will populate the window so you can repeat for as many years as you need to be reopened. The historical years can only be reopened in consecutive order starting with the most previously closed year. Just exit out of these windows once you have the year(s) you want to be reopened.

7. Next click on Cards, point to Financial and click Account. Select the GL account you need and change the Posting Type field to Balance Sheet or Profit and Loss as needed and click Save.

8. When you have finished editing the GL account type, click on Microsoft Dynamics GP, point to Tools, point to Routines, point to Financial and click Year-End Closing and reclose the GL year again. Print/review the Year End Closing report as desired.

Note: When you reopen and reclose a GL year, make sure that the Retained Earnings account being used has not changed, and that no historical data has been purged from that year. 

9. Verify the GL account has or doesn't have a beginning balance as needed. 


Q: Why are some Beginning balances different for GL accounts in which I did not change the posting type? 

A: The system allows you to post one historical year back and it creates separate BBF entries for those transactions. However, now if you reopen and reclose the year, those transactions will now be included in the new BBF entry as if it was actually keyed during the open year. It is now considered a current year transaction for that year rather than a historical year posting and will be included in the BBF entry that is recalculated. 

Microsoft Dynamics GP 2013 SP2, Microsoft Dynamics GP 2010, Microsoft Dynamics GP 10.0 and all prior versions:

Use one of the following methods to correct the posting type for the next year.

• If the account is supposed to be a profit-and-loss account, use Method 1 below.

• If the account is supposed to be a balance sheet account, use Method 2 below.

Note Before you follow the instructions in this article, make sure that you have a complete backup copy of the database that you can restore if a problem occurs.

Method 1: The account is supposed to be a 'profit-and-loss' account

As a balance-sheet account, this account will have a beginning balance after the year-end closing process is completed. To change the account to a profit-and-loss account and to reverse the beginning balance, follow these steps:

On the Cards menu, point to Financial, and then click Account. In the Account Maintenance window, type the account number in the Account field. Make sure that the Posting Type area is set to Balance Sheet, and then click Save. The type needs to be Balance Sheet type at this point so we offset the balance that was carried forward and it doesn't affect the RE account now. 

Use one of the following methods, depending on whether you are registered for multicurrency or not registered:

If you are registered for Multicurrency Management in Microsoft Dynamics GP, follow these steps:
In Microsoft Dynamics GP, point to Tools on the Microsoft Dynamics GP menu, point to Setup, point to Financial and then click Multicurrency.

In the Maintain History area, click to clear the General Ledger Account checkbox.
If you are not registered for Multicurrency Management, open SQL Server Management Studio and run the following statement against the company database:
UPDATE MC40000 SET MNSUMHST = 0

Change the Maintain History settings in the General Ledger Setup window so we don't keep the actual journal entry in the prior year, as we only want to offset the BBF that was created. To change the setting, follow these steps: 

In Microsoft Dynamics GP, point to Tools on the Microsoft Dynamics GP menu, point to Setup, point to Financial and then click General Ledger

In the Maintain History area, click to clear the Accounts checkbox and the Transactions check box.
In the Allow area, click to select the Posting to History check box. We want to be able to post an offsetting journal entry using a prior year date. Click OK.
Reopen the period for the prior Fiscal Year. To do this, follow these steps. 
In Microsoft Dynamics GP, point to Tools on the Microsoft Dynamics GP menu, point to Setup, point to Company and then click Fiscal Periods.
In the Fiscal Periods Setup window, make sure that the Financial period for the recently closed year is open.
Enter a journal entry to offset the incorrect beginning balance. To do this, follow these steps:
On the Transactions menu, point to Financial, and then click General.
In the Transaction Entry window, enter a transaction that reverses the incorrect beginning balance of the profit-and-loss account.
In the Transaction Date field, enter a date that is in the closed fiscal year such as 12/31/201x.

For example, if the profit-and-loss account has an incorrect debit beginning balance of $100.00, create a transaction that credits the profit-and-loss account for $100.00, and then debit the retained earnings account for $100.00.

Click Post. (The General Posting Journal should show the entry listed twice.  The first is for the original entry, but due to our settings, we won't be keeping that, and the second set is for the BBF entry that will offset the balance.)

Note The transaction updates only the current year because the Maintain History settings are not enabled.

Change the Maintain History settings in the General Ledger Setup window back to how they originally were. To do this, follow these steps: 
In Microsoft Dynamics GP, point to Tools on the Microsoft Dynamics GP menu, point to Setup, point to Financial and then click General Ledger.
In the Maintain History area, click to select the Accounts checkbox and the Transactions check box.
To post the transactions to the transaction history, click to select the Posting to History check box under Allow. If you do not want to post the transactions to the transaction history, click to clear this check box. Then, click OK.

Use one of the following methods to change the Multicurrency setting back to how it originally was, depending on whether you are using multicurrency or not:
If you are registered for Multicurrency Management, follow these steps:

In Microsoft Dynamics GP, on the Microsoft Dynamics GP menu, point to Tools, point to Setup, point to Financial, and then click Multicurrency.

In the Maintain History area, click to select the General Ledger Account checkbox.
If you are not registered for Multicurrency Management, open SQL Server Management Studio and run the following statement against the company database:
UPDATE MC40000 SET MNSUMHST = 1

Go back to the Fiscal Period setup and mark to close the Fiscal Period for the prior year again.
Now you can verify the balance on the GL account is $0.00 and then you can change the type on the account to Profit and Loss. To do this, on the Cards menu, point to Financial, and then click Account. In the Account Maintenance window, type the account number in the Account field. In the Posting Type area, click Profit and Loss, and then click Save.

Method 2: The account is supposed to be a 'balance-sheet' account 

As a profit-and-loss account, this account will not have a beginning balance after the year-end closing process is completed. To change the account to a balance sheet account and to create the beginning balance, follow these steps:

On the Cards menu, point to Financial, and then click Account. In the Account Maintenance window, type the account number in the Account field. In the Posting Type area, click Balance Sheet, and then click Save. Select Balance Sheet so that the correcting entry that you make in step 6 later in this section will correctly update the beginning balance for the current year.

Use one of the following methods, depending on whether you are using multicurrency or not:
If you are registered for Multicurrency Management in Microsoft Dynamics GP, follow these steps:
In Microsoft Dynamics GP, point to Tools on the Microsoft Dynamics GP menu, point to Setup, point to Financial and then click Multicurrency.

In the Maintain History area, click to clear the General Ledger Account checkbox.
If you are not registered for Multicurrency Management, open SQL Server Management Studio and run the following statement against the company database:
UPDATE MC40000 SET MNSUMHST = 0

Change the Maintain History settings in the General Ledger Setup window using these steps: 
In Microsoft Dynamics GP, point to Tools on the Microsoft Dynamics GP menu, point to Setup, point to Financial and then click General Ledger.

In the Maintain History area, click to clear the Accounts checkbox and the Transactions check box.
In the Allow area, click to select the Posting to History check box, and then click OK.
Verify fiscal period is open so you can post to the prior year. To do this, follow these steps. 
In Microsoft Dynamics GP, point to Tools on the Microsoft Dynamics GP menu, point to Setup, point to Company and then click Fiscal Periods.

In the Fiscal Periods Setup window, make sure that the Financial period for the recently closed year is open.

Enter a journal entry to create a beginning balance for the account. To do this, follow these steps:
On the Transactions menu, point to Financial, and then click General.

In the Transaction Entry window, enter a transaction that creates the correct beginning balance of the balance sheet account.
In the Transaction Date field, enter a date that is in the closed fiscal year.

For example, if the balance sheet account should have a debit beginning balance of $100.00, create a transaction that credits the retained earnings account for $100.00 and that debits the balance sheet account for $100.00.
Click Post.

Note The transaction updates only the current year because the Maintain History settings are not enabled.

Change the Maintain History settings in the General Ledger Setup window back to how they originally were. To do this, follow these steps: 

In Microsoft Dynamics GP, point to Tools on the Microsoft Dynamics GP menu, point to Setup, point to Financial and then click General Ledger.

In the Maintain History area, click to select the Accounts checkbox and the Transactions check box.

To post the transactions to the transaction history, click to select the Posting to History check box under Allow. If you do not want to post the transactions to the transaction history, click to clear this check box. Then, click OK.

Go back to the Fiscal Period setup and mark to close the Fiscal Period for the prior year again
Use one of the following methods to change the Multicurrency setting back to how it originally was, depending on whether you are using multicurrency or you are not:

If you are registered for Multicurrency Management, follow these steps:

In Microsoft Dynamics GP, point to Tools on the Microsoft Dynamics GP menu, point to Setup, point to Financial and then click Multicurrency.
In the Maintain History area, click to select the General Ledger Account checkbox.
If you are not registered for Multicurrency Management, open SQL Server Management Studio and run the following statement against the company database:
UPDATE MC40000 SET MNSUMHST = 1

Undo Bank Reconciliation in Microsoft Dynamics GP

Here are the scripts for undo Bank Reconciliation in Microsoft Dynamics GP.


  • Determine the Recon# of the reconciliation to be un-done (replace XXXXX with the appropriate Checkbook ID):
           select * from CM20500 where CHEKBKID = ‘XXXXX’ order by RECONUM
  • Change the transactions in that recon to not reconciled (replace the ##.##### with the exact RECONUM determined in #1 above):
          update CM20200 set Recond = 0 where RECONUM = ‘##.#####’
          update CM20200 set ClrdAmt = 0 where RECONUM = ‘##.#####’
          update CM20200 set clearedate = 0000-00-00 where RECONUM = ‘##.#####’
          update CM20200 set RECONUM = 0 where RECONUM = ‘##.#####’
  • Remove the Recon from history (replace the ##.##### with the exact RECONUM determined in #1 above):
          delete CM20500 where RECONUM = ‘##.#####’
  • Update the Checkbook Master with the revised Last Recon Date and Last Recon Amount (Replace MM with the desired Month and DD with desired day. Repace #######.## with the appropriate amount – no commas. Replace XXXXX with the appropriate Checkbook ID):
          update CM00100 set Last_Reconciled_Date = ‘2010-MM-DD 00:00:00.000′ where
          CHEKBKID = ‘XXXXX’
          update CM00100 set Last_Reconciled_BALANCE = ‘#######.##’ where CHEKBKID =
          ‘XXXXX’
       
           In my case the customer wanted all bank reconciliations deleted and they only had one
           checkbook, so I didn’t have to worry about the “where” sections of the scripts in steps 2
           and 3.  I also then ran step 4 but when I went to look at the checkbook in GP the Last
           Reconciled Date and Amount fields weren’t available to edit like they normally are when
           you first setup a checkbook.

  • After taking a look at the checkbook in the CM00100 I noticed one additional column that needed to get updated in my case.  Running the following script allowed me to have access to those two fields on the checkbook maintenance window:
          Update the Reconcilded column to a 0 to enter a Last Reconciled and Last Reconciled Amount
          Update CM00100 set Recond=0 where CHECKBKID = ‘XXXXX’


IMPORTANT: As always make sure you have good backups before performing any data manipulation in SQL tables and if at all possible first do it in a test company, so that you can validate that you get the results that you want.

Script for Delete Stranded User Activity in Microsoft SQL Server

In this article, we will going to use a script to delete the activity table records for a specific stranded user in Dynamics GP. This will enable us not to have all the users log out of GP in order to execute these scripts. This is typically handy when we have many users signed into the system from various regions and its a tough job to have all the users sign off the system for this maintenance to be done. Please make sure that you must take a back up of DYNAMICS database before you execute this script.


DECLARE @USERID CHAR(15)
DECLARE @CMPNYNAM CHAR(30)

SET @USERID = 'testuser'
SET @CMPNYNAM = 'Fabrikam, Inc.'

/*Deleting the user record from the DEX_LOCK table*/
DELETE FROM tempdb.dbo.DEX_LOCK
WHERE session_id = ( SELECT SQLSESID
FROM DYNAMICS.dbo.ACTIVITY
WHERE USERID = @USERID
AND CMPNYNAM = RTRIM(@CMPNYNAM)
)

/*Deleting the user record from the DEX_SESSION table*/
DELETE FROM tempdb.dbo.DEX_SESSION
WHERE session_id = ( SELECT SQLSESID
FROM DYNAMICS.dbo.ACTIVITY
WHERE USERID = @USERID
AND CMPNYNAM = RTRIM(@CMPNYNAM)
)

/*Deleting the user record from the SY00801 table*/
DELETE FROM DYNAMICS.dbo.SY00801
WHERE USERID = @USERID
AND CMPANYID = ( SELECT CMPANYID
FROM DYNAMICS.dbo.SY01500
WHERE CMPNYNAM = RTRIM(@CMPNYNAM)
)

/*Deleting the user record from the SY00800 table*/
DELETE FROM DYNAMICS.dbo.SY00800
WHERE USERID = @USERID
AND CMPNYNAM = RTRIM(@CMPNYNAM)

/*Deleting the user record from the ACTIVITY table*/
DELETE FROM DYNAMICS.dbo.ACTIVITY
WHERE USERID = @USERID
AND CMPNYNAM = RTRIM(@CMPNYNAM)