How to alter View Script Field’s Data Entry size in Sage CRM

By | November 13, 2015

As we all know, Sage CRM works on SQL views to return records in response to user searches and to present relationships between different entities. For example, a view might list all the cases associated with a particular company that are assigned to a specific user. Creating advanced user-defined views entails administrators employing SQL operations such as Joins, and therefore requires basic SQL scripting skills. These views are also responsible to extract data through Mail Merge activity of CRM. However, many a times user is unable to create/update a view with a SQL script of huge lines.
New Stuff: JavaScript to print Amount (In Words)
The View Script Field does not accepts all lines of SQL script therefore leading to SQL error. The first ever thing that would come in any developer’s mind will be to increase field size from backend. But on checking that particular field length in database, there was no option to alter the field size as it was already set as nvarchar (max). Yet making it difficult for me to save the View content.
On exploring many of the forums & blog site, finally I was able to understand the exact issue as well as found a solution for the same. Though the CuVi_ViewScript field length was set as maxlength, the CuVi_ViewScript was liable to accept only 3900 characters in its text area. To remove this restriction you can follow steps as explained below.
1. Navigate to Administration | Customization | Translations section.
2. Type ‘Secterr’ under Caption Code field and click Find.
3. A record with Caption Code ‘SecTerrColumnsRequiredForPrimaryEntityView’ will be listed out.
Blog 1
4. Click on the Caption Code to navigate to the Translation Details screen.
5. Add below script under every field of Translation.
<script>
$(document).ready(function ()
{
$(‘textarea[name=CuVi_ViewScript]’).removeAttr(“maxLength”);
});
</script>
Blog 2
6. Save the details and execute the Metadata Refresh.
However, this option will work in Sage CRM v7.2 and v7.3. To apply the same in CRM v7.1 and below, create a js file of the script provided in Step # 5. Call this js file under Translation details screen shown in above screen shot. Once done, you will now be able to modify/save the view details with 10000 and more no. of SQL Script lines.
Also Read:
1. New Tables, Views and Log files introduced in Sage CRM 7.3
2. You may need to recreate views manually – II
3. How to add the Mobile Phone and Private Phone fields to the views being used by Find screens, Reports and Groups
4. How to access views of Different Database in CRM
5. You may need to recreate views manually