Connections: Difference between revisions

From Accelerator for SageCRM
No edit summary
No edit summary
 
(11 intermediate revisions by the same user not shown)
Line 2: Line 2:


When you first open the app it will prompt you to create a connection.
When you first open the app it will prompt you to create a connection.
Note: If running on the Office 365 add-in your CRM needs to be accessible from the internet and runs on https:// (SSL)
EG
    https://crm.yourdomain.com/crm


[[File:ac_connection1.png]]
[[File:ac_connection1.png]]
Line 58: Line 64:
....leave any code in between thats there already...and do not copy this line in  :)
....leave any code in between thats there already...and do not copy this line in  :)
   </system.webServer>
   </system.webServer>
'''If you do see it check that
    "Access-Control-Allow-Headers"
has the value
    "Content-type, App-Mode, App-Capacitor-Platform, App-Connector, App-Container, App-version, Authorization, X-MS-Proxy"
set


'''If you do not see it then add it in. '''
'''If you do not see it then add it in. '''


Add in the section
Add in the section (OR UPDATE IT)


     <httpProtocol>
     <httpProtocol>
       <customHeaders>
       <customHeaders>
         <add name="Access-Control-Allow-Origin" value="*" />
         <add name="Access-Control-Allow-Headers" value="Content-type, App-Mode, App-Capacitor-Platform, App-Connector, App-Container, App-version, Authorization, X-MS-Proxy" />
        <add name="Access-Control-Allow-Headers" value="*" />
         <add name="Access-Control-Allow-Methods" value="GET,PUT,POST,DELETE,PATCH,OPTIONS" />
         <add name="Access-Control-Allow-Methods" value="GET,PUT,POST,DELETE,PATCH,OPTIONS" />
         <add name="Access-Control-Allow-Credentials" value="true" />
         <add name="Access-Control-Allow-Credentials" value="true" />
         <add name="Access-Control-Allow-Private-Network" value="true" />
         <add name="Access-Control-Allow-Private-Network" value="true" />
        <add name="Vary" value="Origin" />
       </customHeaders>
       </customHeaders>
     </httpProtocol>
     </httpProtocol>
Line 83: Line 95:
then after </httpProtocol> (THIS IS THE CLOSING TAG AND NOT THE OPENING ONE)add in
then after </httpProtocol> (THIS IS THE CLOSING TAG AND NOT THE OPENING ONE)add in


<pre>
<rewrite>
  <outboundRules>
    <clear />
    <rule name="AddCrossDomainHeader">
      <match
        serverVariable="RESPONSE_Access_Control_Allow_Origin"
        pattern=".*"
      />


    <rewrite>
      <conditions logicalGrouping="MatchAll">
            <outboundRules>
        <add
                <clear />               
          input="{HTTP_ORIGIN}"
                <rule name="AddCrossDomainHeader">
          pattern="^(capacitor://localhost|https?://localhost(:\d+)?|https?://(.+\.)?crmtogether\.com|https?://(.+\.)?msappproxy\.net|https?://(.+\.)?mail\.google\.com)$"
                    <match serverVariable="RESPONSE_Access_Control_Allow_Origin" pattern=".*" />
        />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="true">
      </conditions>
                        <add input="{HTTP_ORIGIN}" pattern="(http(s)?://((.+\.)?crmtogether\.com|(.+\.)?localhost\#|(.+\.)?capacitor\.com))" />
                    </conditions>
                    <action type="Rewrite" value="{C:0}" />
                </rule>         
            </outboundRules>
        </rewrite>


      <action
        type="Rewrite"
        value="{HTTP_ORIGIN}"
      />
    </rule>
  </outboundRules>
</rewrite>
</pre>


No need to restart IIS or anything. Just save the file.
No need to restart IIS or anything. Just save the file.
*** UPDATE: 2 July 2026 ***
Changed the pattern to fix Native Android


*** UPDATE: 17 March 2024 ***
*** UPDATE: 17 March 2024 ***

Latest revision as of 09:58, 7 September 2026

This page is to help you set up your Sage CRM connection

When you first open the app it will prompt you to create a connection.

Note: If running on the Office 365 add-in your CRM needs to be accessible from the internet and runs on https:// (SSL)

EG

    https://crm.yourdomain.com/crm

Click the PLUS (+) button and you will see a dialog

1. Enter in your CRM url in one fo the formats

 * https://crm.yourserver.com/CRM/
 * http://yourserver/CRM/

2. CRM Username

3. CRM User password

4. Remember me (stores the password)

5. Connection name - Internal name

6. Connection Caption - The text you see in the screen

7. Enabled - Tab is not shown if not enabled

8. Connect - Tries to login and saves the connection details


=

Troubleshoot

Help ref# 77342

If you get a CORS issue like the image below

It could be an issue with your web.config in that it is missing the CORS xml code

On your CRM server open "custompages/sagecrmws/web.config" and search for the "<system.webServer>" section.

You should see a number of "Access-Control-Allow-..." options within the "<system.webServer>" section.

 <system.webServer>
   <httpProtocol>
     <customHeaders>
       <add name="Access-Control-Allow-Origin" value="*" />
       <add name="Access-Control-Allow-Headers" value="*" />
       <add name="Access-Control-Allow-Methods" value="GET,PUT,POST,DELETE,PATCH,OPTIONS" />
       <add name="Access-Control-Allow-Credentials" value="true" />
       <add name="Access-Control-Allow-Private-Network" value="true" />
     </customHeaders>
   </httpProtocol>

....leave any code in between thats there already...and do not copy this line in  :)

 </system.webServer>

If you do see it check that

   "Access-Control-Allow-Headers" 

has the value

   "Content-type, App-Mode, App-Capacitor-Platform, App-Connector, App-Container, App-version, Authorization, X-MS-Proxy" 

set

If you do not see it then add it in.

Add in the section (OR UPDATE IT)

   <httpProtocol>
     <customHeaders>
       <add name="Access-Control-Allow-Headers" value="Content-type, App-Mode, App-Capacitor-Platform, App-Connector, App-Container, App-version, Authorization, X-MS-Proxy" />
       <add name="Access-Control-Allow-Methods" value="GET,PUT,POST,DELETE,PATCH,OPTIONS" />
       <add name="Access-Control-Allow-Credentials" value="true" />
       <add name="Access-Control-Allow-Private-Network" value="true" />
       <add name="Vary" value="Origin" />
     </customHeaders>
   </httpProtocol>

between

 <system.webServer>

and

 </system.webServer>

then after </httpProtocol> (THIS IS THE CLOSING TAG AND NOT THE OPENING ONE)add in

<rewrite>
  <outboundRules>
    <clear />

    <rule name="AddCrossDomainHeader">
      <match
        serverVariable="RESPONSE_Access_Control_Allow_Origin"
        pattern=".*"
      />

      <conditions logicalGrouping="MatchAll">
        <add
          input="{HTTP_ORIGIN}"
          pattern="^(capacitor://localhost|https?://localhost(:\d+)?|https?://(.+\.)?crmtogether\.com|https?://(.+\.)?msappproxy\.net|https?://(.+\.)?mail\.google\.com)$"
        />
      </conditions>

      <action
        type="Rewrite"
        value="{HTTP_ORIGIN}"
      />
    </rule>
  </outboundRules>
</rewrite>

No need to restart IIS or anything. Just save the file.

      • UPDATE: 2 July 2026 ***

Changed the pattern to fix Native Android

      • UPDATE: 17 March 2024 ***

It appears that a wildcard header in the “Access-Control-Allow-Origin” header is no longer accepted. This causes a CORS issue and you cannot log in. We fixed this using the details above