Others Archives - Page 5 of 5 - - Page 5

Category Archives: Others

Retrieve records from NetSuite on basis of Custom field value

Introduction: In this blog, we will have a look on how the records can be retrieved from NetSuite on basis of a custom field value. Scenario: We had a client with requirement to integrate their NetSuite environment to CRM environment. The integration process from NetSuite basically triggers on the scheduled time set on the server scheduler. One of the entity that gets integrated is “Customer”. When Customer record is updated in NetSuite, a Boolean field known as “Dirty flag” is set as true in NetSuite. While integration the records retrieved are based on the Boolean field “Dirty flag”. Only the records which have Dirty flag as true are retrieved. The code that retrieves the updated records from NetSuite is as follows: The search is done based on a Boolean custom field. The search value for this field should be set as true. The above code is to search records from all the pages. The page size mentioned is 5 in the above code. Thus, each page will have maximum of 5 records on one page.  

Share Story :

Blog Automation

Posted On April 17, 2017 by Ankit Gupta Posted in

Purpose: The purpose of this blog article is to automate the process of Blog submission for real-time tracking. Introduction: Blogs are the most important factor of online marketing these days and rather I should say that they are Marketing Investment. Blog articles: Build trust and demonstrate your expertise. Provide valuable content for social media and act as a good reference. Attract relevant traffic to the website. Connect people to your brand and hence generate leads, ultimately leading to sales. Blog writing is important, but tracking them is also equally important. If we can automate the process, then we can track it better and in real time. So, we decided to automate blog submissions in CloudFronts. To automate the process, I created two login accounts in WordPress. One for blogger who can post his blog article, and another for reviewer, who can review submitted posts and publish them after approval. I created the blogger account with minimum permissions. Blogger will directly land on creating a new post page and can only create a post, upload images and select post category. Since, the WordPress rich text editor gives all options for content editing, blogger can easily write his blog or copy-paste blog content from any other text editor. Steps for submitting a blog article: Log in to the WordPress backend. Write blog article content. Upload media files and use necessary styling. Select your name, category and submit the blog for the review. Once blogger is done with his/her post, he can submit the blog for the review. The reviewer will get the review notification, along with the preview and review link. He can review and make any changes, if required. If he is satisfied with the blog, he can publish the blog. Blog Status: To track the monthly blog submissions, I have created a page, where anyone can check the current month blog submission status. Also, I have created a page to check last month status too. There are 3 sections on this Blog Status page. First one is the list of team members, who have submitted their blog articles for the current month. The second section is the list of team members, who have submitted their blog articles, but are pending for review and hence are not published yet. And, third section is the list of names, who have not submitted their current month’s blog article. Questions & Answers: Now, there must be some questions going on in your mind. So, I have prepared a list of questions, that might arise in your mind. What if blogger messes up something in WordPress Backend? Don’t worry!! Blogger’s role capability in this WordPress system is just a contributor and he can’t change anything on website or backend. He can just add his blog posts. The worst thing that can happen is improper blog submission, and that too is just a submission, not publication. It can’t go live without approval, so no need to worry about it. Is any HTML tag knowledge required for writing blog articles? No! The WordPress rich text editor allows you to edit the content almost as any text editor. Blog articles normally use default paragraph, image, content heading, point-wise listing, anchor links, bold text, italics, underline and preformatted tags. And, you can do all this with WordPress editor. Can blogger directly copy and paste content from Microsoft Word? Sorry, but directly copying content from Microsoft Word will add unnecessary tags and it will mess up your blog post layout. You can use “Paste as Text” option from Visual Editor or copy as plain text from Notepad and then style the post, as you want. You can use any WordPress editing option to style your blog post, then. Can a blogger directly copy paste images from Microsoft Word? Again, No! WordPress does not work like Outlook. It needs images to be uploaded in its directory and hence you will need to upload every single image. What if a blogger need to add extra styling or tags? If you are familiar with HTML tags, you can do it in the editor only. You can find complete HTML markup of your blog article under TEXT Tab (by default Visual tab is selected). You can add or delete any tag here. But make sure that it is proper, as it might cause a formatting issue. Also, you can add your custom inline styling here. Always preview your post, before submitting it. Apart from all these questions, please let me know if you have any other question. Conclusion: Automating the process leads to better management of blog articles. Blog submissions can be tracked in real time and hence it gives better data, rather than just manually checking blog submissions.  

Share Story :

NetSuite Customer Join in SuiteTalk

Posted On March 31, 2017 by Admin Posted in

Introduction: This blog explains how to use Customer Join in Contacts. Problem Statement: We often get requirement from Client to get only Contacts for specific Customers. After following below solution, you can achieve your requirement. Solution: Below is code snippet which explains how to use Customer Join for Contact. Conclusion: Below image confirms we have received Contacts for a specific Customer.

Share Story :

Basics of Assertion in C#

Posted On August 28, 2015 by Admin Posted in

In this blog we will be explaining the basics of Assertion in C# code. The use of assert statements can be an effective way to catch program logic errors at runtime, and yet they are easily filtered out of production code. Usually assertions should not be used to check for errors in a user’s input. It may, however, make sense to use assertions to verify that a caller has already checked a user’s input. In Visual Basic and Visual C#, you can use the Assert method from either Debug or Trace, which are in the System.Diagnostics namespace. Debug class methods are not included in a Release version of your program, so they do not increase the size or reduce the speed of your release code. An assertion interrupts normal operation of the program but does not terminate the application. The Debug.Assert or Trace.Assert method in the System.Diagnostics class provides a way to implement this. An assertion, or Assert statement, where you specify as an argument to the Assert statement. If the condition evaluates to true, no action occurs. If the condition evaluates to false, the assertion fails. If you are running with a debug build, your program enters break mode. Usually, you want assertions during development. And In release builds, you usually want assertions to be off to reduce the overhead in release build. But for some release builds it makes sense to have assertions on during the initial stages. Debug.Assert will not be called in the release version of the code. If you want assert to be in the release version then you should replace Debug.Assert with Trace.Assert, which does not disappear in the release version. Example as we all know that in case of division divisor can never be zero. You might test this using an assertion as shown below public float Divide(int dividend , int divisor) { Debug.Assert(divisor !=0); return (dividend/ divisor); } If we need to check divisor can never be zero in the release build, we can modify the above code as shown below. public float Divide(int dividend , int divisor) { Trace.Assert(divisor !=0); return (dividend/ divisor); } When you use Debug.Assert, make sure that any code inside Assert does not change the results of the program if Assert is removed. Otherwise, you might accidentally introduce a bug that only shows up in the Release version of your program. As shown in following example. Debug.Assert (DecrementCounter(count) != 0 ); At first glance we can say that above code will work properly and brake whenever condition become false. Here every time whenever “DecrementCounter” Counter is called then value of “count” will be decremented. When you build the Release version, this call to “DecrementCounter” is eliminated, so the “count” does not get updated. Eliminating Call to function will result to bug in the release environment. To avoid such error we can use temporary variable for comparison as shown below. int Temp= DecrementCounter(count); Debug.Assert(Temp !=0); As a best coding practice try and avoid using function call inside the assert method. Parameters of Debug.Assert Method Assert method will take up to three arguments. The first argument, which is mandatory, is the condition you want to check. If you call Assert method with only one argument, the Assert method checks the condition and, if the result is false, outputs the contents of the call stack to the Output window. The second and third arguments are optional parameters. If you call assert method with two or three argument, then method check then condition as per the first parameter and if the result is false, outputs the second and third message strings. Second message is a brief description or title of an error while third message is a detailed description of an error. Summary You’ll only need assertions if your code reaches a certain complexity. For example you know that variable A should be not be zero, but the instruction flow up to that point is so complicated that you can’t easily trace it at a glance. That’s when you use an assertion to make sure your program works correctly. There’s not much point to using assertions in simple and obvious code that doesn’t do much internally, like a simple data entry screen. In that case, just use exceptions to test external conditions. The problem with throwing an exception is some calling function might catch it and silently recover. Then you’d never know about your bug. But using an assertion guarantees you’ll be made aware of the bug.

Share Story :

Delegate in C#

In this blog we will be explaining you about Delegate in C# and types of delegate. In simple terms, C# has a data type that allows developers to pass methods as parameters of other methods. This data type is called a delegate. A delegate is a type that represents references to methods with a particular parameter list and return type. When you instantiate a delegate, you can associate its instance with any method with a compatible signature and return type. You can invoke (or call) the method through the delegate instance. A delegate is a references type that invokes single/multiple method(s) through the delegate instance. It holds a reference of the methods. Delegate types are sealed and immutable type. A useful property of delegate objects is that they can be composed using the “+” operator. A composed delegate calls the two delegates it was composed from. Only delegates of the same type can be composed. The “-” operator can be used to remove a component delegate from a composed delegate. When you instantiate a delegate by using a named method, the method is passed as a parameter. Delegates constructed with a named method can encapsulate either a static method or an instance method. Named methods are the only way to instantiate a delegate in earlier versions of C#. Concept of Anonymous method was introduced in C# ver. 2.0, where you can pass code block as a parameters to separately defined method. C# ver. 3.0 introduced lambda expressions as a more crisp way of writing inline code blocks. Both anonymous methods and lambda are compiled to delegate types. Together, these features are now known as anonymous functions. In C# ver. 1.0 and later, delegates can be declared as shown below. // Declare a delegate. delegate void Del(string str); // Declare a method with the same signature as the delegate. static void Notify(string name) { Console.WriteLine(“Notification received for: {0}”, name); } // Create an instance of the delegate. Del del1 = new Del(Notify); In C# ver. 2.0 and later, it is also possible to use an anonymous method to declare and initialize a delegate, as shown below. Del del2 = delegate(string name) { Console.WriteLine(“Notification received for: {0}”, name); }; In C# ver. 3.0 and later, delegates can also be declared and instantiated by using a lambda expression, as shown below. Del del3 = name =>  { Console.WriteLine(“Notification received for: {0}”, name); }; Use of Delegate Abstract and encapsulate a method: – This is the most important use of delegates, it helps us to define an abstract pointer which can point to methods and functions. The same abstract delegate can be later used to point to that type of functions and methods. 2. Asynchronous processing: – By using ‘BeginInvoke’ and ‘EndInvoke’ we can call delegates asynchronously. 3. Multicasting (Sequential processing): –Some time we would like to call some methods in a sequential manner which can be done by using multicast delegate. Delegates are useful when: The caller has no need to access other properties, methods, or interfaces on the object implementing the method. When a class may want to have multiple implementations of the method specification. It is desirable to allow using a static method to implement the specification. The provider of the implementation wants to “hand out” the implementation of the specification to only a few select components. Types of Delegate There are three types of delegates that can be used in C#. Single cast Delegate: – Single cast delegate means which hold address of single method. In the single cast delegate signature of delegate should be same as method for which we are creating this delegate. Multi cast Delegate: – Multi cast delegate is used to hold address of multiple methods in single delegate. To hold multiple addresses with delegate we will use “+=” operator and if you want remove addresses from delegate we need to use “-=“operator. Multicast delegates will work only for the methods which have return type only void. If we want to create a multicast delegate with return type we will get the return type of last method in the invocation list. Generic Delegate: – Generic Delegates was introduced in Framework 3.5, a generic delegate can define its own type parameters. Code that references the generic delegate can specify the type argument to create a closed constructed type, just like when instantiating a generic class or calling a generic method. Generic Delegates are especially useful in defining events based on the typical design pattern because the sender argument can be strongly typed and no longer has to be cast to and from Object. Delegate in a nutshell Delegates are similar to the function pointer in C and C++, difference between the function pointer and delegate is that delegates are type safe. Delegates are objects that contain information about the function rather than data. We can encapsulate a reference to the method inside the delegate object. Delegates provide a simple way of representing a method call, potentially with a target object, as a piece of data which can be passed around. It is not necessary to use delegation with parameters, we can use delegates with and without parameters. We can use static or non-static function, in case of static function we encapsulate the function with class name and in the case of a non-static function we first make the object of the class and then we use a function with the object.  

Share Story :

WordPress Gravity Form – Microsoft CRM Integration

This blog is about integration of Gravity Form plugin with the Microsoft Dynamics CRM. This part contains the WordPress end implementation. Gravity Forms is an advanced contact form plugin for WordPress powered websites and is used by millions of sites. Gravity form simply allows you to select your fields, configure your options and easily embed forms on your site using the built-in tools. We will implement Gravity form on website so that the values submitted in it will directly go to CRM as lead. STEPS: Firstly, install the Gravity form, which you can purchase depending on your requirement. [Link : http://www.gravityforms.com/purchase-gravity-forms/] Set up your fields as per your requirement and note the field ID. Also call the form wherever you want to use (page editor or php template or widget). Now, you have to use the Gravity Form’s gform_after_submission function along with the field ID’s to pass the parameters. Once you are done with the form implementation, next step is to write code for passing the parameters in functions.php file of current theme. add_action( ‘gform_after_submission’, ‘post_to_third_party’, 10, 2 ); function post_to_third_party( $entry, $form ) { $post_url = ‘http://thirdparty.com’; $body = array( ‘first_name’ => rgar( $entry, ‘1.3’ ), ‘last_name’ => rgar( $entry, ‘1.6’ ), ‘message’ => rgar( $entry, ‘3’ ), ); $request = new WP_Http(); $response = $request->post( $post_url, array( ‘body’ => $body ) ); } Here: post_url = URL of the page where your web service is written/called. first_name (or last_name or message) = Name of parameters used in web service where values will be stored. You can create any number of fields and pass their values. ($entry, ‘3’) = Here 3 is the id of the field in gravity form, whose value will be passed in the ‘message’ parameter. For name, we have two ID’s as it has first name and second name fields. gform_after_submission = Function executed at the end of the form submission process (after form validation, notification, and entry creation). If you want to implement this for any particular form, then you can use “gform_after_submission_FORM-ID” like gform_after_submission_2. Now the values of the fields filled in Gravity Form will be passed to web service and then it will be stored as Lead in CRM. We recommend you to use captcha with form to avoid spam entries in CRM. Reference: https://www.gravityhelp.com/documentation/article/gform_after_submission/  

Share Story :

SEARCH BLOGS:

[gravityform id="36" ajax="true"]

FOLLOW CLOUDFRONTS BLOG :